Skip to content

Commit

Permalink
pass filtered jobs to apply via global
Browse files Browse the repository at this point in the history
  • Loading branch information
greole committed Apr 30, 2024
1 parent 369c4a1 commit 4a1bb9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/obr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,15 @@ def apply(ctx: click.Context, **kwargs):
logger.error(f"Could not find {kwargs['file']}")
sys.exit(1)

project, jobs = cli_cmd_setup(kwargs)
global filtered_jobs
project, filtered_jobs = cli_cmd_setup(kwargs)

os.environ["OBR_APPLY_FILE"] = str(apply_file_path)
os.environ["OBR_APPLY_CAMPAIGN"] = kwargs.get("campaign", "")
sys.argv.append("--aggregate")
sys.argv.append("-t")
sys.argv.append("1")
project.run(
jobs=jobs,
names=["apply"],
progress=True,
np=1,
Expand Down
5 changes: 5 additions & 0 deletions src/obr/signac_wrapper/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,11 @@ def archive(job: Job, args={}) -> Literal[True]:
@OpenFOAMProject.operation(aggregator=flow.aggregator())
def apply(*jobs, args={}):
import importlib.util
import obr.cli
# NOTE in order to allow job filtering for apply
# we need to bypass the whatever project.run provides
jobs = obr.cli.filtered_jobs
print(len(jobs))

fp = Path(os.environ.get("OBR_APPLY_FILE"))
spec = importlib.util.spec_from_file_location("apply_func", fp)
Expand Down

0 comments on commit 4a1bb9f

Please sign in to comment.