|
11 | 11 | )
|
12 | 12 | from snakemake_interface_common.exceptions import WorkflowError # noqa
|
13 | 13 |
|
14 |
| -import htcondor |
| 14 | +import htcondor2 as htcondor |
15 | 15 | import traceback
|
16 | 16 | from os.path import join, basename, abspath, dirname
|
17 | 17 | from os import makedirs, sep
|
@@ -65,23 +65,6 @@ class ExecutorSettings(ExecutorSettingsBase):
|
65 | 65 | can_transfer_local_files=True,
|
66 | 66 | )
|
67 | 67 |
|
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 |
| - |
85 | 68 | # Required:
|
86 | 69 | # Implementation of your executor
|
87 | 70 | class Executor(RemoteExecutor):
|
@@ -244,13 +227,8 @@ def run_job(self, job: JobExecutorInterface):
|
244 | 227 |
|
245 | 228 | # Submitting job to HTCondor
|
246 | 229 | 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() |
250 | 231 | submit_result = schedd.submit(submit_description)
|
251 |
| - except CredsError as ce: |
252 |
| - traceback.print_exc() |
253 |
| - print(f"CredsError occurred: {ce}") |
254 | 232 | except Exception as e:
|
255 | 233 | traceback.print_exc()
|
256 | 234 | raise WorkflowError(f"Failed to submit HTCondor job: {e}")
|
@@ -296,8 +274,11 @@ async def check_active_jobs(
|
296 | 274 | "JobStatus",
|
297 | 275 | ],
|
298 | 276 | )
|
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}.") |
301 | 282 | except Exception as e:
|
302 | 283 | self.logger.warning(f"Failed to retrieve HTCondor job status: {e}")
|
303 | 284 | # Assuming the job is still running and retry next time
|
|
0 commit comments