Skip to content

Commit

Permalink
fix: Allow mock butler in addtional butler calls
Browse files Browse the repository at this point in the history
fix: Allow alias paths in condor submit files
  • Loading branch information
tcjennings committed Jan 17, 2025
1 parent 8ab128f commit 04ba7cb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/lsst/cmservice/common/butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from lsst.daf.butler import Butler, MissingCollectionError

from ..common import errors
from ..config import config


async def remove_run_collections(
Expand All @@ -28,6 +29,7 @@ async def remove_run_collections(
fake_reset: bool
Allow for missing butler
"""
fake_reset = fake_reset or config.butler.mock
try:
butler_f = partial(
Butler.from_config,
Expand Down Expand Up @@ -68,6 +70,7 @@ async def remove_non_run_collections(
fake_reset: bool
Allow for missing butler
"""
fake_reset = fake_reset or config.butler.mock
try:
butler_f = partial(
Butler.from_config,
Expand Down Expand Up @@ -109,6 +112,7 @@ async def remove_collection_from_chain(
fake_reset: bool
Allow for missing butler
"""
fake_reset = fake_reset or config.butler.mock
if fake_reset:
return
raise NotImplementedError
Expand Down Expand Up @@ -137,6 +141,7 @@ async def remove_datasets_from_collections(
fake_reset: bool
Allow for missing butler
"""
fake_reset = fake_reset or config.butler.mock
if fake_reset:
return
raise NotImplementedError
23 changes: 15 additions & 8 deletions src/lsst/cmservice/common/htcondor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@


async def write_htcondor_script(
htcondor_script_path: str | Path,
htcondor_log: str | Path,
script_url: str | Path,
log_url: str | Path,
htcondor_script_path: Path,
htcondor_log: Path,
script_url: Path,
log_url: Path,
**kwargs: Any,
) -> Path:
"""Write a submit wrapper script for htcondor
Parameters
----------
htcondor_script_path: str | anyio.Path
htcondor_script_path: anyio.Path
Path for the wrapper file written by this function
htcondor_log: str | anyio.Path
htcondor_log: anyio.Path
Path for the wrapper log
script_url: str | anyio.Path
script_url: anyio.Path
Script to submit
log_url: str | anyio.Path
log_url: anyio.Path
Location of job log file to write
Returns
Expand All @@ -58,6 +58,13 @@ async def write_htcondor_script(
)
options.update(**kwargs)

if config.htcondor.alias_path is not None:
_alias = Path(config.htcondor.alias_path)
# FIXME can we use the actual campaign prod_area here
script_url = _alias / script_url.relative_to("/output")
htcondor_log = _alias / htcondor_log.relative_to("/output")
log_url = _alias / log_url.relative_to("/output")

htcondor_script_contents = [
f"executable = {script_url}",
f"log = {htcondor_log}",
Expand Down
6 changes: 6 additions & 0 deletions src/lsst/cmservice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ class HTCondorConfiguration(BaseModel):
description="...", default=True, serialization_alias="_condor_DAGMAN_MANAGER_JOB_APPEND_GETENV"
)

alias_path: str | None = Field(
description="The alias path to use in htcondor submission files instead of a campaign's prod_area",
default=None,
exclude=True,
)


class SlurmConfiguration(BaseModel):
"""Configuration settings for slurm client operations.
Expand Down

0 comments on commit 04ba7cb

Please sign in to comment.