Skip to content

Update HTCondor API to remove deprecation warning #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ if [ "\$1" == "" ]; then
exit 1
else
export COFFEA_IMAGE=\$1
export COFFEA_IMAGE_FULL=\$(realpath /cvmfs/unpacked.cern.ch/registry.hub.docker.com/\${COFFEA_IMAGE})
fi

export APPTAINER_BINDPATH=${APPTAINER_BINDPATH}${APPTAINER_BINDPATH:+,}/uscmst1b_scratch,/cvmfs,/cvmfs/grid.cern.ch/etc/grid-security:/etc/grid-security,${LPC_CONDOR_CONFIG},${LPC_CONDOR_LOCAL}:${LPC_CONDOR_LOCAL}.orig,.cmslpc-local-conf:${LPC_CONDOR_LOCAL}

APPTAINER_SHELL=\$(which bash) apptainer exec -B \${PWD}:/srv --pwd /srv \\
/cvmfs/unpacked.cern.ch/registry.hub.docker.com/\${COFFEA_IMAGE} \\
/bin/bash --rcfile /srv/.bashrc
\$COFFEA_IMAGE_FULL /bin/bash --rcfile /srv/.bashrc
EOF

cat <<EOF > .cmslpc-local-conf
Expand Down
33 changes: 13 additions & 20 deletions src/lpcjobqueue/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def __init__(
image,
**base_class_kwargs,
):
image = self.container_prefix + image
if ship_env:
base_class_kwargs["python"] = f"{self.env_name}/bin/python"
base_class_kwargs.setdefault(
Expand Down Expand Up @@ -93,20 +92,10 @@ async def start(self):
job = htcondor.Submit(job)

def sub():
try:
classads = []
with SCHEDD().transaction() as txn:
cluster_id = job.queue(txn, ad_results=classads)

logger.debug(f"ClassAds for job {cluster_id}: {classads}")
SCHEDD().spool(classads)
return cluster_id
except htcondor.HTCondorInternalError as ex:
logger.error(str(ex))
return None
except htcondor.HTCondorIOError as ex:
logger.error(str(ex))
return None
result = SCHEDD().submit(job, spool=True)
cluster_id = result.cluster()
SCHEDD().spool(list(job.jobs(clusterid=cluster_id)))
return cluster_id

self.job_id = await asyncio.get_event_loop().run_in_executor(SCHEDD_POOL, sub)
if self.job_id:
Expand Down Expand Up @@ -147,7 +136,7 @@ def check_gone():
SCHEDD_POOL, check_gone
)
except RuntimeError as ex:
if str(ex) == "cannot schedule new futures after interpreter shutdown":
if str(ex) == "cannot schedule new futures after shutdown":
logger.info(f"Thread pool lost while checking worker {self.name} job {self.job_id}")
# We're not going to be able to do anything async now
self.status = Status.undefined
Expand Down Expand Up @@ -211,7 +200,7 @@ class LPCCondorCluster(HTCondorCluster):
run workers from that environent. This allows user-installed packages
to be available on the worker
image: str
Name of the apptainer image to use (default: $COFFEA_IMAGE)
Name of the apptainer image to use (default: $COFFEA_IMAGE_FULL)
transfer_input_files: str, List[str]
Files to be shipped along with the job. They will be placed in the
working directory of the workers, as usual for HTCondor. Any paths
Expand All @@ -234,9 +223,13 @@ def __init__(self, **kwargs):
kwargs.setdefault("scheduler_options", {})
kwargs["scheduler_options"].setdefault("host", f"{hostname}:{self._port}")
kwargs.setdefault("ship_env", False)
kwargs.setdefault(
"image", os.environ.get("COFFEA_IMAGE", "coffeateam/coffea-dask:latest")
)
try:
if "image" not in kwargs:
kwargs["image"] = os.environ["COFFEA_IMAGE_FULL"]
except KeyError:
raise RuntimeError("$COFFEA_IMAGE_FULL environment not set. Please re-run bootstrap to update your enviornment")
if not os.path.exists(kwargs["image"]):
raise RuntimeError(f"{kwargs['image']} does not exist. Please specify a full path to an apptainer image")
self._ship_env = kwargs["ship_env"]
infiles = kwargs.pop("transfer_input_files", [])
if not isinstance(infiles, list):
Expand Down