Don't try to reupload settings on retry
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
this.SettingsProcessor.ValidateSettings(Instance, settings);
|
this.SettingsProcessor.ValidateSettings(Instance, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Randomize(string id, SeedSettings settings) {
|
public async Task Randomize(string id, SeedSettings settings, bool uploadSettings = true) {
|
||||||
Logger.LogDebug("Recieved request for id {id} to randomize settings {@settings}", id, settings);
|
Logger.LogDebug("Recieved request for id {id} to randomize settings {@settings}", id, settings);
|
||||||
|
|
||||||
var start = new ProcessStartInfo() {
|
var start = new ProcessStartInfo() {
|
||||||
@@ -90,9 +90,11 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
if (uploadSettings) {
|
||||||
var settingsOut = string.Format("{0}/settings.json", id);
|
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
var settingsOut = string.Format("{0}/settings.json", id);
|
||||||
|
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task GenerationSucceeded(string id, SeedSettings settings) {
|
private async Task GenerationSucceeded(string id, SeedSettings settings) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
public const string Name = "base";
|
public const string Name = "base";
|
||||||
public const string DungeonMapName = "dungeon_map";
|
public const string DungeonMapName = "dungeon_map";
|
||||||
|
|
||||||
public const int MULTI_TRIES = 80;
|
public const int MULTI_TRIES = 100;
|
||||||
public const int SINGLE_TRIES = 5;
|
public const int SINGLE_TRIES = 5;
|
||||||
|
|
||||||
public BaseRandomizer(
|
public BaseRandomizer(
|
||||||
@@ -125,14 +125,15 @@
|
|||||||
process.Exited += async (sender, args) => {
|
process.Exited += async (sender, args) => {
|
||||||
try {
|
try {
|
||||||
this.ShutdownHandler.RemoveId(id);
|
this.ShutdownHandler.RemoveId(id);
|
||||||
|
Logger.LogInformation("Generation {id} has exited with exit code {exitCode}", id, process.ExitCode);
|
||||||
await completed.Invoke(process.ExitCode);
|
await completed.Invoke(process.ExitCode);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
this.Logger.LogError(ex, "Error while invoking completion of randomizer generation.");
|
this.Logger.LogError(ex, "Error while invoking completion of randomizer generation {id}.", id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Randomize(string id, SeedSettings settings) {
|
public async Task Randomize(string id, SeedSettings settings, bool uploadSettings = true) {
|
||||||
Logger.LogDebug("Recieved request for id {id} to randomize settings {@settings}", id, settings);
|
Logger.LogDebug("Recieved request for id {id} to randomize settings {@settings}", id, settings);
|
||||||
|
|
||||||
var args = this.GetArgs(settings).Append(string.Format("--tries={0}", SINGLE_TRIES));
|
var args = this.GetArgs(settings).Append(string.Format("--tries={0}", SINGLE_TRIES));
|
||||||
@@ -145,12 +146,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
if (uploadSettings) {
|
||||||
var settingsOut = string.Format("{0}/settings.json", id);
|
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
var settingsOut = string.Format("{0}/settings.json", id);
|
||||||
|
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RandomizeMultiworld(string id, IList<SeedSettings> settings) {
|
public async Task RandomizeMultiworld(string id, IList<SeedSettings> settings, bool uploadSettings = true) {
|
||||||
var randomizerName = this.SettingsProcessor.GetRandomizerName(settings[0].Randomizer);
|
var randomizerName = this.SettingsProcessor.GetRandomizerName(settings[0].Randomizer);
|
||||||
Logger.LogDebug("Recieved request for id {id} to randomize multiworld settings {@settings}", id, settings);
|
Logger.LogDebug("Recieved request for id {id} to randomize multiworld settings {@settings}", id, settings);
|
||||||
|
|
||||||
@@ -169,9 +172,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
if (uploadSettings) {
|
||||||
var settingsOut = string.Format("{0}/settings.json", id);
|
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
var settingsOut = string.Format("{0}/settings.json", id);
|
||||||
|
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SingleSucceeded(string id) {
|
private async Task SingleSucceeded(string id) {
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
public interface IRandomizer {
|
public interface IRandomizer {
|
||||||
public void Validate(SeedSettings settings);
|
public void Validate(SeedSettings settings);
|
||||||
|
|
||||||
public Task Randomize(string id, SeedSettings settings);
|
public Task Randomize(string id, SeedSettings settings, bool uploadSettings = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
var randomizer = this.ServiceProvider.GetRequiredKeyedService<IRandomizer>(randomizerKey);
|
var randomizer = this.ServiceProvider.GetRequiredKeyedService<IRandomizer>(randomizerKey);
|
||||||
randomizer.Validate(settings);
|
randomizer.Validate(settings);
|
||||||
|
|
||||||
await randomizer.Randomize(id, settings);
|
await randomizer.Randomize(id, settings, seedId == null);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
this.BaseRandomizer.ValidateAll(settings);
|
this.BaseRandomizer.ValidateAll(settings);
|
||||||
|
|
||||||
await this.BaseRandomizer.RandomizeMultiworld(id, settings);
|
await this.BaseRandomizer.RandomizeMultiworld(id, settings, multiId == null);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user