Skip to content

Comments

Detect existing campaign#13

Merged
JoelLucaAdams merged 4 commits intomainfrom
detect-existing-campaign
Sep 12, 2025
Merged

Detect existing campaign#13
JoelLucaAdams merged 4 commits intomainfrom
detect-existing-campaign

Conversation

@JoelLucaAdams
Copy link
Collaborator

When creating a new Campaign object, the _counter is always initialised to 0, regardless of whether there are existing runs in the campaign directory. This causes previously completed runs to be overwritten if a new campaign object is created for the same directory.

This behaviour is particularly problematic in active learning workflows, where simulations are run iteratively and a new Campaign object is created after each run to generate a new input.deck.

A new function, allocate_next_run_number, has been introduced which searches all existing directories and returns the highest run number plus 1, or 0 if no runs exist. Only the lowest-level run directories are considered (e.g., 'run_0', 'run_50').

@LiamPattinson
Copy link

Maybe this could include a toggle argument append: bool = False so that the current behaviour is still the default, but users have the option of adding to an existing set of runs?

@JoelLucaAdams
Copy link
Collaborator Author

append flag has now been added which decides whether to append new runs to the end of an existing campaign (if True) or overwrite it (if False)

@JoelLucaAdams JoelLucaAdams merged commit 89b742b into main Sep 12, 2025
@JoelLucaAdams
Copy link
Collaborator Author

JoelLucaAdams commented Sep 12, 2025

resolves #13

@JoelLucaAdams JoelLucaAdams linked an issue Sep 12, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to resume campaign

2 participants