Skip to content

Commit 68a345f

Browse files
Merge pull request #2 from jhiemstrawisc/v2-bindings-upgrade
Upgrade to the V2 bindings to resolve credentials error
2 parents 1b5e71c + 0bc061a commit 68a345f

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ documentation = "https://snakemake.github.io/snakemake-plugin-catalog/plugins/ex
1515
python = "^3.11"
1616
snakemake-interface-common = "^1.17.1"
1717
snakemake-interface-executor-plugins = "^9.0.0"
18-
htcondor = "^23.4.0"
18+
htcondor = "^24.5.1"
1919

2020
[tool.poetry.group.dev.dependencies]
2121
black = "^24.2.0"

snakemake_executor_plugin_htcondor/__init__.py

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212
from snakemake_interface_common.exceptions import WorkflowError # noqa
1313

14-
import htcondor
14+
import htcondor2 as htcondor
1515
import traceback
1616
from os.path import join, basename, abspath, dirname
1717
from os import makedirs, sep
@@ -65,23 +65,6 @@ class ExecutorSettings(ExecutorSettingsBase):
6565
can_transfer_local_files=True,
6666
)
6767

68-
def get_creds() -> bool:
69-
"""
70-
Get credentials to avoid job going on hold due to lack of credentials
71-
"""
72-
# thanks @tlmiller
73-
local_provider_name = htcondor.param.get("LOCAL_CREDMON_PROVIDER_NAME")
74-
if local_provider_name is None:
75-
return False
76-
magic = ("LOCAL:%s" % local_provider_name).encode()
77-
credd = htcondor.Credd()
78-
credd.add_user_cred(htcondor.CredTypes.Kerberos, magic)
79-
return True
80-
81-
82-
class CredsError(Exception):
83-
pass
84-
8568
# Required:
8669
# Implementation of your executor
8770
class Executor(RemoteExecutor):
@@ -244,13 +227,8 @@ def run_job(self, job: JobExecutorInterface):
244227

245228
# Submitting job to HTCondor
246229
try:
247-
have_creds = get_creds()
248-
if not have_creds:
249-
raise CredsError("Credentials not found for this workflow")
230+
submit_description.issue_credentials()
250231
submit_result = schedd.submit(submit_description)
251-
except CredsError as ce:
252-
traceback.print_exc()
253-
print(f"CredsError occurred: {ce}")
254232
except Exception as e:
255233
traceback.print_exc()
256234
raise WorkflowError(f"Failed to submit HTCondor job: {e}")
@@ -296,8 +274,11 @@ async def check_active_jobs(
296274
"JobStatus",
297275
],
298276
)
299-
# Storing the one event from HistoryIterator to list
300-
job_status = [next(job_status)]
277+
# Storing the one event from history list
278+
if job_status and len(job_status) >= 1:
279+
job_status = [job_status[0]]
280+
else:
281+
raise ValueError(f"No job status found in history for HTCondor job with Cluster ID {current_job.external_jobid}.")
301282
except Exception as e:
302283
self.logger.warning(f"Failed to retrieve HTCondor job status: {e}")
303284
# Assuming the job is still running and retry next time

0 commit comments

Comments
 (0)