lsst-ctrl-bps-htcondor 29.2025.2100__py3-none-any.whl → 29.2025.2300__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -401,6 +401,54 @@ class HTCondorService(BaseWmsService):
401
401
  _LOG.debug("job_ids = %s", job_ids)
402
402
  return job_ids
403
403
 
404
+ def get_status(
405
+ self,
406
+ wms_workflow_id: str,
407
+ hist: float = 1,
408
+ is_global: bool = False,
409
+ ) -> tuple[WmsStates, str]:
410
+ """Return status of run based upon given constraints.
411
+
412
+ Parameters
413
+ ----------
414
+ wms_workflow_id : `str`
415
+ Limit to specific run based on id (queue id or path).
416
+ hist : `float`, optional
417
+ Limit history search to this many days. Defaults to 1.
418
+ is_global : `bool`, optional
419
+ If set, all job queues (and their histories) will be queried for
420
+ job information. Defaults to False which means that only the local
421
+ job queue will be queried.
422
+
423
+ Returns
424
+ -------
425
+ state : `lsst.ctrl.bps.WmsStates`
426
+ Status of single run from given information.
427
+ message : `str`
428
+ Extra message for status command to print. This could be pointers
429
+ to documentation or to WMS specific commands.
430
+ """
431
+ _LOG.debug("get_status: id=%s, hist=%s, is_global=%s", wms_workflow_id, hist, is_global)
432
+
433
+ id_type = _wms_id_type(wms_workflow_id)
434
+ _LOG.debug("id_type = %s", id_type.name)
435
+
436
+ if id_type == WmsIdType.LOCAL:
437
+ schedulers = _locate_schedds(locate_all=is_global)
438
+ _LOG.debug("schedulers = %s", schedulers)
439
+ state, message = _get_status_from_id(wms_workflow_id, hist, schedds=schedulers)
440
+ elif id_type == WmsIdType.GLOBAL:
441
+ schedulers = _locate_schedds(locate_all=True)
442
+ _LOG.debug("schedulers = %s", schedulers)
443
+ state, message = _get_status_from_id(wms_workflow_id, hist, schedds=schedulers)
444
+ elif id_type == WmsIdType.PATH:
445
+ state, message = _get_status_from_path(wms_workflow_id)
446
+ else:
447
+ state, message = WmsStates.UNKNOWN, "Invalid job id"
448
+ _LOG.debug("state: %s, %s", state, message)
449
+
450
+ return state, message
451
+
404
452
  def report(
405
453
  self,
406
454
  wms_workflow_id=None,
@@ -1014,6 +1062,77 @@ def _handle_job_inputs(generic_workflow: GenericWorkflow, job_name: str, use_sha
1014
1062
  return htc_commands
1015
1063
 
1016
1064
 
1065
+ def _get_status_from_id(
1066
+ wms_workflow_id: str, hist: float, schedds: dict[str, htcondor.Schedd]
1067
+ ) -> tuple[WmsStates, str]:
1068
+ """Gather run information using workflow id.
1069
+
1070
+ Parameters
1071
+ ----------
1072
+ wms_workflow_id : `str`
1073
+ Limit to specific run based on id.
1074
+ hist : `float`
1075
+ Limit history search to this many days.
1076
+ schedds : `dict` [ `str`, `htcondor.Schedd` ]
1077
+ HTCondor schedulers which to query for job information. If empty
1078
+ dictionary, all queries will be run against the local scheduler only.
1079
+
1080
+ Returns
1081
+ -------
1082
+ state : `lsst.ctrl.bps.WmsStates`
1083
+ Status for the corresponding run.
1084
+ message : `str`
1085
+ Message with extra error information.
1086
+ """
1087
+ _LOG.debug("_get_status_from_id: id=%s, hist=%s, schedds=%s", wms_workflow_id, hist, schedds)
1088
+
1089
+ message = ""
1090
+
1091
+ # Collect information about the job by querying HTCondor schedd and
1092
+ # HTCondor history.
1093
+ schedd_dag_info = _get_info_from_schedd(wms_workflow_id, hist, schedds)
1094
+ if len(schedd_dag_info) == 1:
1095
+ schedd_name = next(iter(schedd_dag_info))
1096
+ dag_id = next(iter(schedd_dag_info[schedd_name]))
1097
+ dag_ad = schedd_dag_info[schedd_name][dag_id]
1098
+ state = _htc_status_to_wms_state(dag_ad)
1099
+ else:
1100
+ state = WmsStates.UNKNOWN
1101
+ message = f"DAGMan job {wms_workflow_id} not found in queue or history. Check id or try path."
1102
+ return state, message
1103
+
1104
+
1105
+ def _get_status_from_path(wms_path: str | os.PathLike) -> tuple[WmsStates, str]:
1106
+ """Gather run status from a given run directory.
1107
+
1108
+ Parameters
1109
+ ----------
1110
+ wms_path : `str` | `os.PathLike`
1111
+ The directory containing the submit side files (e.g., HTCondor files).
1112
+
1113
+ Returns
1114
+ -------
1115
+ state : `lsst.ctrl.bps.WmsStates`
1116
+ Status for the run.
1117
+ message : `str`
1118
+ Message to be printed.
1119
+ """
1120
+ wms_path = Path(wms_path).resolve()
1121
+ message = ""
1122
+ try:
1123
+ wms_workflow_id, dag_ad = read_dag_log(wms_path)
1124
+ except FileNotFoundError:
1125
+ wms_workflow_id = MISSING_ID
1126
+ message = f"DAGMan log not found in {wms_path}. Check path."
1127
+
1128
+ if wms_workflow_id == MISSING_ID:
1129
+ state = WmsStates.UNKNOWN
1130
+ else:
1131
+ state = _htc_status_to_wms_state(dag_ad[wms_workflow_id])
1132
+
1133
+ return state, message
1134
+
1135
+
1017
1136
  def _report_from_path(wms_path):
1018
1137
  """Gather run information from a given run directory.
1019
1138
 
@@ -1139,11 +1258,11 @@ def _get_info_from_schedd(
1139
1258
  ----------
1140
1259
  wms_workflow_id : `str`
1141
1260
  Limit to specific run based on id.
1142
- hist : `int`
1261
+ hist : `float`
1143
1262
  Limit history search to this many days.
1144
- schedds : `dict` [ `str`, `htcondor.Schedd` ], optional
1145
- HTCondor schedulers which to query for job information. If None
1146
- (default), all queries will be run against the local scheduler only.
1263
+ schedds : `dict` [ `str`, `htcondor.Schedd` ]
1264
+ HTCondor schedulers which to query for job information. If empty
1265
+ dictionary, all queries will be run against the local scheduler only.
1147
1266
 
1148
1267
  Returns
1149
1268
  -------
@@ -1152,6 +1271,8 @@ def _get_info_from_schedd(
1152
1271
  Scheduler, local HTCondor job ids are mapped to their respective
1153
1272
  classads.
1154
1273
  """
1274
+ _LOG.debug("_get_info_from_schedd: id=%s, hist=%s, schedds=%s", wms_workflow_id, hist, schedds)
1275
+
1155
1276
  dag_constraint = 'regexp("dagman$", Cmd)'
1156
1277
  try:
1157
1278
  cluster_id = int(float(wms_workflow_id))
@@ -1376,6 +1376,7 @@ def condor_search(constraint=None, hist=None, schedds=None):
1376
1376
 
1377
1377
  job_info = condor_q(constraint=constraint, schedds=schedds)
1378
1378
  if hist is not None:
1379
+ _LOG.debug("Searching history going back %s days", hist)
1379
1380
  epoch = (datetime.now() - timedelta(days=hist)).timestamp()
1380
1381
  constraint += f" && (CompletionDate >= {epoch} || JobFinishedHookDone >= {epoch})"
1381
1382
  hist_info = condor_history(constraint, schedds=schedds)
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "29.2025.2100"
2
+ __version__ = "29.2025.2300"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lsst-ctrl-bps-htcondor
3
- Version: 29.2025.2100
3
+ Version: 29.2025.2300
4
4
  Summary: HTCondor plugin for lsst-ctrl-bps.
5
5
  Author-email: Rubin Observatory Data Management <dm-admin@lists.lsst.org>
6
6
  License: BSD 3-Clause License
@@ -2,18 +2,18 @@ lsst/ctrl/bps/htcondor/__init__.py,sha256=1gTmOVLJILvBqgqHVECo8uqoX8e4fiTeH_dHBU
2
2
  lsst/ctrl/bps/htcondor/final_post.sh,sha256=chfaQV6Q7rGsK-8Hx58ch52m-PofvBanrl7VwCssHec,248
3
3
  lsst/ctrl/bps/htcondor/handlers.py,sha256=2gM3Ac00in4ob9ckcP331W1LSEjs9UDKIqt4MULA4bg,11196
4
4
  lsst/ctrl/bps/htcondor/htcondor_config.py,sha256=c4lCiYEwEXFdxgbMfEkbDm4LrvkRMF31SqLtQqzqIV4,1523
5
- lsst/ctrl/bps/htcondor/htcondor_service.py,sha256=Cn4_muurzMzOSJeP3GZWpi8o_DskNL9Wgz2ZEPrNhng,90979
6
- lsst/ctrl/bps/htcondor/lssthtc.py,sha256=Rsfr7ZehZHiRWmF-8FMDReZQrGMtKii7CO2O8Vu9hYg,80420
5
+ lsst/ctrl/bps/htcondor/htcondor_service.py,sha256=4_jm0lIZw3mYXyays1IWyg3pFwpODR_-g6CLIepXu7w,95330
6
+ lsst/ctrl/bps/htcondor/lssthtc.py,sha256=pYxcA5jicuJs1RnhusSuMFrOU92Xy1fb-tleZ9m784Y,80485
7
7
  lsst/ctrl/bps/htcondor/provisioner.py,sha256=hPN8YJUtwNHQylw68kfskF1S2vCeQvztF8W0d_QKqqM,7851
8
- lsst/ctrl/bps/htcondor/version.py,sha256=czd5myijXlfzN1l1OFP7x6hn5ASHoE02wXhI32IqLec,55
8
+ lsst/ctrl/bps/htcondor/version.py,sha256=GnyaHNlpLZJmdCekPuL3VEJCw758_rgDNpEpGPT5mRw,55
9
9
  lsst/ctrl/bps/htcondor/etc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  lsst/ctrl/bps/htcondor/etc/htcondor_defaults.yaml,sha256=xDRts4vHKov2PE_JRh-0nF3jfuNJXtKBXZqveASp_iA,1422
11
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/licenses/COPYRIGHT,sha256=Lc6NoAEFQ65v_SmtS9NwfHTOuSUtC2Umbjv5zyowiQM,61
12
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/licenses/LICENSE,sha256=pRExkS03v0MQW-neNfIcaSL6aiAnoLxYgtZoFzQ6zkM,232
13
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/licenses/bsd_license.txt,sha256=7MIcv8QRX9guUtqPSBDMPz2SnZ5swI-xZMqm_VDSfxY,1606
14
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/licenses/gpl-v3.0.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
15
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/METADATA,sha256=zJ6h3GvvoztRNyTngXqRLYeLjJUL9wSvkZg5GrHZPVA,2139
16
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
17
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/top_level.txt,sha256=eUWiOuVVm9wwTrnAgiJT6tp6HQHXxIhj2QSZ7NYZH80,5
18
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
19
- lsst_ctrl_bps_htcondor-29.2025.2100.dist-info/RECORD,,
11
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/licenses/COPYRIGHT,sha256=Lc6NoAEFQ65v_SmtS9NwfHTOuSUtC2Umbjv5zyowiQM,61
12
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/licenses/LICENSE,sha256=pRExkS03v0MQW-neNfIcaSL6aiAnoLxYgtZoFzQ6zkM,232
13
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/licenses/bsd_license.txt,sha256=7MIcv8QRX9guUtqPSBDMPz2SnZ5swI-xZMqm_VDSfxY,1606
14
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/licenses/gpl-v3.0.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
15
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/METADATA,sha256=x97wexe47Mag59sqQ7et2qQ-y12yBlO2pyGjzNAXBME,2139
16
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/top_level.txt,sha256=eUWiOuVVm9wwTrnAgiJT6tp6HQHXxIhj2QSZ7NYZH80,5
18
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
19
+ lsst_ctrl_bps_htcondor-29.2025.2300.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5