Don't try to reupload settings on retry
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
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);
|
||||
|
||||
var start = new ProcessStartInfo() {
|
||||
@@ -90,9 +90,11 @@
|
||||
}
|
||||
};
|
||||
|
||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||
var settingsOut = string.Format("{0}/settings.json", id);
|
||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||
if (uploadSettings) {
|
||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||
var settingsOut = string.Format("{0}/settings.json", id);
|
||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task GenerationSucceeded(string id, SeedSettings settings) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
public const string Name = "base";
|
||||
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 BaseRandomizer(
|
||||
@@ -125,14 +125,15 @@
|
||||
process.Exited += async (sender, args) => {
|
||||
try {
|
||||
this.ShutdownHandler.RemoveId(id);
|
||||
Logger.LogInformation("Generation {id} has exited with exit code {exitCode}", id, process.ExitCode);
|
||||
await completed.Invoke(process.ExitCode);
|
||||
} 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);
|
||||
|
||||
var args = this.GetArgs(settings).Append(string.Format("--tries={0}", SINGLE_TRIES));
|
||||
@@ -145,12 +146,14 @@
|
||||
}
|
||||
});
|
||||
|
||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||
var settingsOut = string.Format("{0}/settings.json", id);
|
||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||
if (uploadSettings) {
|
||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||
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);
|
||||
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);
|
||||
var settingsOut = string.Format("{0}/settings.json", id);
|
||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||
if (uploadSettings) {
|
||||
var settingsJson = JsonSerializer.SerializeToDocument(settings, JsonOptions.Default);
|
||||
var settingsOut = string.Format("{0}/settings.json", id);
|
||||
await AzureStorage.UploadFile(settingsOut, new BinaryData(settingsJson));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SingleSucceeded(string id) {
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
public interface IRandomizer {
|
||||
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);
|
||||
randomizer.Validate(settings);
|
||||
|
||||
await randomizer.Randomize(id, settings);
|
||||
await randomizer.Randomize(id, settings, seedId == null);
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
this.BaseRandomizer.ValidateAll(settings);
|
||||
|
||||
await this.BaseRandomizer.RandomizeMultiworld(id, settings);
|
||||
await this.BaseRandomizer.RandomizeMultiworld(id, settings, multiId == null);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user