Skip to content

Commit

Permalink
Change restart behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sivonxay committed Oct 4, 2023
1 parent 7f8a428 commit 5c9a0b1
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/NanoParticleTools/flows/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,23 @@ def npmc_job(constraints: Sequence[NanoParticleConstraint],
'Existing run found, but some files are missing. ')
fresh_start = True

if override or os.path.exists(output_dir) is False or fresh_start:
if os.path.exists(output_dir):
# delete the directory, so we can start from scratch
shutil.rmtree(output_dir)

# Make the directory
os.mkdir(output_dir)

npmc_input.generate_initial_state_database(
files['initial_state_db_path'], **_initial_state_db_args)
npmc_input.generate_nano_particle_database(files['np_db_path'])
with open(files['npmc_input'], 'w') as f:
json.dump(npmc_input, f, cls=MontyEncoder)
else:
raise RuntimeError(
'Existing run found. Override is set to false, terminating')
if fresh_start:
if override or os.path.exists(output_dir) is False:
if os.path.exists(output_dir):

Check warning on line 181 in src/NanoParticleTools/flows/jobs.py

View check run for this annotation

Codecov / codecov/patch

src/NanoParticleTools/flows/jobs.py#L179-L181

Added lines #L179 - L181 were not covered by tests
# delete the directory, so we can start from scratch
shutil.rmtree(output_dir)

Check warning on line 183 in src/NanoParticleTools/flows/jobs.py

View check run for this annotation

Codecov / codecov/patch

src/NanoParticleTools/flows/jobs.py#L183

Added line #L183 was not covered by tests

# Make the directory
os.mkdir(output_dir)

Check warning on line 186 in src/NanoParticleTools/flows/jobs.py

View check run for this annotation

Codecov / codecov/patch

src/NanoParticleTools/flows/jobs.py#L186

Added line #L186 was not covered by tests

npmc_input.generate_initial_state_database(

Check warning on line 188 in src/NanoParticleTools/flows/jobs.py

View check run for this annotation

Codecov / codecov/patch

src/NanoParticleTools/flows/jobs.py#L188

Added line #L188 was not covered by tests
files['initial_state_db_path'], **_initial_state_db_args)
npmc_input.generate_nano_particle_database(files['np_db_path'])
with open(files['npmc_input'], 'w') as f:
json.dump(npmc_input, f, cls=MontyEncoder)

Check warning on line 192 in src/NanoParticleTools/flows/jobs.py

View check run for this annotation

Codecov / codecov/patch

src/NanoParticleTools/flows/jobs.py#L190-L192

Added lines #L190 - L192 were not covered by tests
else:
raise RuntimeError(

Check warning on line 194 in src/NanoParticleTools/flows/jobs.py

View check run for this annotation

Codecov / codecov/patch

src/NanoParticleTools/flows/jobs.py#L194

Added line #L194 was not covered by tests
'Existing run found. Override is set to false, terminating')

# Initialize the wrapper class to run NPMC
npmc_runner = NPMCRunner(
Expand Down

0 comments on commit 5c9a0b1

Please sign in to comment.