Glue Compatibility API Reference
glue.pipeline integration: drop a ‘request a simulation’ node into an existing DAG.
The use case: a user has a hyperpipeline DAG (or any glue.pipeline DAG) and wants to add ONE node that says “ensure simulation X is present in the archive at level >= N” before downstream nodes run. The user shouldn’t have to reimplement the top-level workflow.
Example:
from glue import pipeline from RIFT.simulation_manager.glue_compat import RequestSimulationJob
dag = pipeline.CondorDAG(log=’/tmp/dag.log’)
- sim_job = RequestSimulationJob(
archive_path=’/path/to/archive’, log_dir=’/tmp/sim_logs’, request_memory=2048, accounting_group=’ligo.dev.o4.cbc.pe.lalinferencerapid’, accounting_group_user=’albert.einstein’,
) sim_job.set_sub_file(‘request_sim.sub’) sim_job.write_sub_file()
- for params in points_of_interest:
node = sim_job.make_node(params=params, target_level=4) dag.add_node(node) downstream_node.add_parent(node) # everything downstream
# blocks until the sim is ready
The node’s executable is the request_sim CLI (a thin Python entrypoint that registers + dispatches + blocks). When DAGMan runs the node it calls the CLI, which (a) returns immediately if the sim is already at the requested level or (b) dispatches run-pool work and blocks until ready. Either way DAGMan sees a normal exit-code-driven node.
- class RIFT.simulation_manager.glue_compat.RequestSimulationJob(archive_path: str | Path, log_dir: str | Path = '.', universe: str = 'vanilla', mode: str = 'ensure', request_memory: int = 1024, request_disk: str | None = None, accounting_group: str | None = None, accounting_group_user: str | None = None, getenv: str = 'True', extra_condor_cmds: Dict[str, str] | None = None, poll_interval: float | None = None, timeout: float | None = None, argv_prefix: List[str] | None = None)
Bases:
CondorDAGJobA glue.pipeline CondorDAGJob that runs the request_sim CLI.
Construct once per (archive, request profile); call make_node per (params, target_level) you want to ensure. The job’s executable invokes
python -m RIFT.simulation_manager.cli.request_sim
with –archive / –params / –target-level supplied as macros on each node.
- make_node(params: Any, target_level: int = 1, category: str | None = None, retry: int | None = None) CondorDAGNode
Build a CondorDAGNode for one request. Caller adds it to their DAG and wires up parents/children as usual.
- RIFT.simulation_manager.glue_compat.make_request_simulation_node(dag: Any, archive_path: str | Path, params: Any, target_level: int = 1, *, sub_file: str | Path | None = None, reuse_job: Any | None = None, **job_kwargs: Any) Any
One-shot helper: build (or reuse) a RequestSimulationJob, attach a node for params to dag, and return the node.
For multiple nodes per DAG, prefer constructing the job once and calling job.make_node(…) repeatedly — that writes a single .sub file shared across all nodes.