fc19934ba6
b2luigi's AnalysisComputeTask now submits the per-(plot, chunk) jobs, so the bespoke submit-file generator has nothing left to do: - giant/analysis/condor.py -> giant/analysis/run.py, dropping SubmitConfig, the wrapper/submit-description templates, _job_walltimes and _resolve_giant_executable. What stays is the actual logic — prep, RunMeta, the rollout-YAML loading, compute_reduced/compute_one and merge_one/merge_all — and the module no longer submits anything, hence the name. - `giant analyze submit` is gone; prep / compute-one / merge-one / list / render / metrics remain as the single-step primitives the workflow calls. - tests/test_condor.py -> tests/test_analysis_run.py, minus the submit-description cases. CLAUDE.md and README.md document the workflow package, the new `workflow` extra, and — for whenever condor-gpu-train-rollout is merged — that its train-submit/rollout-submit commands are deliberately superseded and must not be revived. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
83 lines
3.0 KiB
Python
83 lines
3.0 KiB
Python
"""HTCondor job descriptions for the workflow tasks.
|
|
|
|
b2luigi writes every key of a task's ``htcondor_settings`` dict straight into
|
|
that job's submit description, so these helpers are just the ETP-specific
|
|
resource/requirement conventions in one place:
|
|
|
|
* **CPU jobs** (setup cache, geometry oracle, analysis compute) keep what
|
|
the deleted ``giant analyze submit`` used: ``+RemoteJob`` for grid I/O, or
|
|
``TARGET.ProvidesETPResources`` when the files are local to the cluster.
|
|
* **GPU jobs** (training epochs, rollout) are remote-only, so they always
|
|
carry ``+RemoteJob`` and reach ``/ceph`` through
|
|
``TARGET.ProvidesEtpCeph`` — the requirement strings are ported from the
|
|
``condor-gpu-train-rollout`` branch's ``giant/condor.py`` rather than
|
|
rewritten, since they encode what the ETP HTCondor wiki documents for
|
|
TOpAS/NEMO2 GPU workers.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from giant.workflow.spec import CondorSpec
|
|
|
|
__all__ = ["cpu_settings", "gpu_settings", "gpu_requirements"]
|
|
|
|
|
|
def cpu_settings(
|
|
condor: CondorSpec,
|
|
*,
|
|
request_memory_mb: int | None = None,
|
|
request_cpus: int | None = None,
|
|
walltime_s: int | None = None,
|
|
) -> dict:
|
|
settings: dict = {
|
|
"universe": "docker",
|
|
"docker_image": condor.docker_image_cpu,
|
|
"request_memory": request_memory_mb if request_memory_mb is not None else condor.request_memory_mb,
|
|
"request_cpus": request_cpus if request_cpus is not None else condor.request_cpus,
|
|
"accounting_group": condor.accounting_group,
|
|
"should_transfer_files": "YES",
|
|
"when_to_transfer_output": "ON_EXIT",
|
|
}
|
|
if condor.remote:
|
|
settings["+RemoteJob"] = "True"
|
|
else:
|
|
settings["requirements"] = "TARGET.ProvidesETPResources"
|
|
if walltime_s is not None:
|
|
settings["+RequestWalltime"] = int(walltime_s)
|
|
return settings
|
|
|
|
|
|
def gpu_requirements(gpu_type: str | None = None, gpu_memory_mb: int | None = None) -> str:
|
|
"""``TARGET.ProvidesEtpCeph`` (remote /ceph access) ANDed with any GPU pin."""
|
|
clauses = ["TARGET.ProvidesEtpCeph =?= True"]
|
|
if gpu_type is not None:
|
|
clauses.append(f'TARGET.GPUs_DeviceName =?= "{gpu_type}"')
|
|
if gpu_memory_mb is not None:
|
|
clauses.append(f"TARGET.GPUs_GlobalMemoryMb >= {gpu_memory_mb}")
|
|
return " && ".join(clauses)
|
|
|
|
|
|
def gpu_settings(
|
|
condor: CondorSpec,
|
|
*,
|
|
request_gpus: int = 1,
|
|
gpu_type: str | None = None,
|
|
gpu_memory_mb: int | None = None,
|
|
request_memory_mb: int = 16384,
|
|
request_cpus: int = 4,
|
|
walltime_s: int = 86400,
|
|
) -> dict:
|
|
return {
|
|
"universe": "docker",
|
|
"docker_image": condor.docker_image_gpu,
|
|
"request_memory": request_memory_mb,
|
|
"request_cpus": request_cpus,
|
|
"RequestGPUs": request_gpus,
|
|
"+RequestWalltime": int(walltime_s),
|
|
"accounting_group": condor.accounting_group,
|
|
"should_transfer_files": "YES",
|
|
"when_to_transfer_output": "ON_EXIT",
|
|
"+RemoteJob": "True",
|
|
"requirements": f"({gpu_requirements(gpu_type, gpu_memory_mb)})",
|
|
}
|