Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Jul 3, 2023
1 parent 17d4f5f commit bfd81bb
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions pyiron_base/jobs/job/runfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,22 @@ def run_job_with_runmode_srun(job):


def run_job_with_runmode_executor(job, executor, gpus_per_slot=None):
if static_isinstance(obj=job, obj_type="pyiron_base.jobs.master.generic.GenericMaster"):
raise TypeError("Currently job.server.run_mode.executor does not support GenericMaster jobs.")
if static_isinstance(
obj=job, obj_type="pyiron_base.jobs.master.generic.GenericMaster"
):
raise TypeError(
"Currently job.server.run_mode.executor does not support GenericMaster jobs."
)
if flux_available and isinstance(executor, flux.job.FluxExecutor):
return run_job_with_runmode_executor_flux(job=job, executor=executor, gpus_per_slot=gpus_per_slot)
return run_job_with_runmode_executor_flux(
job=job, executor=executor, gpus_per_slot=gpus_per_slot
)
elif isinstance(executor, Executor):
return run_job_with_runmode_executor_futures(job=job, executor=executor)
else:
raise TypeError("Currently only flux.job.FluxExecutor and concurrent.futures.Executor are supported.")
raise TypeError(
"Currently only flux.job.FluxExecutor and concurrent.futures.Executor are supported."
)


def run_job_with_runmode_executor_futures(job, executor):
Expand All @@ -473,7 +481,7 @@ def run_job_with_runmode_executor_futures(job, executor):
job_id=job.job_id,
file_path=None,
debug=False,
connection_string=None
connection_string=None,
)
else:
return executor.submit(
Expand All @@ -482,7 +490,7 @@ def run_job_with_runmode_executor_futures(job, executor):
job_id=job.job_id,
file_path=None,
debug=False,
connection_string=str(job.project.db.conn.engine.url)
connection_string=str(job.project.db.conn.engine.url),
)
else:
return executor.submit(
Expand All @@ -491,7 +499,7 @@ def run_job_with_runmode_executor_futures(job, executor):
job_id=None,
file_path=job.project_hdf5.file_name + job.project_hdf5.h5_path,
debug=False,
connection_string=None
connection_string=None,
)


Expand All @@ -506,7 +514,7 @@ def run_job_with_runmode_executor_flux(job, executor, gpus_per_slot=None):
if not state.database.database_is_disabled:
executable_template = Template(
"#!/bin/bash\n",
"python -m pyiron_base.cli wrapper -p {{working_directory}} -j {{job_id}}"
"python -m pyiron_base.cli wrapper -p {{working_directory}} -j {{job_id}}",
)
exeuctable_str = executable_template.render(
working_directory=job.working_directory,
Expand All @@ -516,7 +524,7 @@ def run_job_with_runmode_executor_flux(job, executor, gpus_per_slot=None):
else:
executable_template = Template(
"#!/bin/bash\n",
"python -m pyiron_base.cli wrapper -p {{working_directory}} -f {{file_name}}{{h5_path}}"
"python -m pyiron_base.cli wrapper -p {{working_directory}} -f {{file_name}}{{h5_path}}",
)
exeuctable_str = executable_template.render(
working_directory=job.working_directory,
Expand Down

0 comments on commit bfd81bb

Please sign in to comment.