rda-python-dsquasar 3.0.20__tar.gz → 3.0.21__tar.gz

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.
Files changed (20) hide show
  1. {rda_python_dsquasar-3.0.20/src/rda_python_dsquasar.egg-info → rda_python_dsquasar-3.0.21}/PKG-INFO +1 -1
  2. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/pyproject.toml +1 -1
  3. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar/dsquasar.py +21 -35
  4. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21/src/rda_python_dsquasar.egg-info}/PKG-INFO +1 -1
  5. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/LICENSE +0 -0
  6. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/MANIFEST.in +0 -0
  7. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/README.md +0 -0
  8. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/setup.cfg +0 -0
  9. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar/__init__.py +0 -0
  10. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar/ds_quasar.py +0 -0
  11. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar/dsquasar.usg +0 -0
  12. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar/dstacc.py +0 -0
  13. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar/taccrec.py +0 -0
  14. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar/tacctar.py +0 -0
  15. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar.egg-info/SOURCES.txt +0 -0
  16. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar.egg-info/dependency_links.txt +0 -0
  17. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar.egg-info/entry_points.txt +0 -0
  18. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar.egg-info/requires.txt +0 -0
  19. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/src/rda_python_dsquasar.egg-info/top_level.txt +0 -0
  20. {rda_python_dsquasar-3.0.20 → rda_python_dsquasar-3.0.21}/test/test_dsquasar.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_dsquasar
3
- Version: 3.0.20
3
+ Version: 3.0.21
4
4
  Summary: RDA Python package to backup and recover RDA data archives to and from GLOBUS Quasar backup server
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-dsquasar
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_dsquasar"
7
- version = "3.0.20"
7
+ version = "3.0.21"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -23,7 +23,6 @@ import os
23
23
  import re
24
24
  import sys
25
25
  import time
26
- import signal
27
26
  from os import path as op
28
27
  from time import time as tm
29
28
  from rda_python_common.pg_cmd import PgCMD
@@ -203,7 +202,7 @@ class DsQuasar(PgCMD, PgSplit):
203
202
  self.cmdlog(self.PGBACK['cmd'])
204
203
  self.PGBACK['starttime'] = tm()
205
204
  self.set_walltime_deadline()
206
- self.catch_batch_termination()
205
+ self.catch_term_signal(self.batch_term_report)
207
206
  if self.sopts['u']:
208
207
  if self.sopts['a']: self.pglog("-u: Dataset IDs must be provided to Unlock datasets", self.LOGWRN)
209
208
  self.unlock_datasets()
@@ -852,42 +851,29 @@ class DsQuasar(PgCMD, PgSplit):
852
851
  self.PGLOG['CURBID'], self.seconds_to_string_time(self.WALLTIME),
853
852
  self.seconds_to_string_time(self.MAXRUNTIME)), self.LOGWRN)
854
853
 
855
- # PBS kills a job that runs out of walltime with SIGTERM first and SIGKILL a few seconds
856
- # later (the MoM's kill_delay, 10 seconds by default), and the same pair is what qdel
857
- # sends. SIGTERM is the only warning there is, and nothing in the common library traps
858
- # it, so the run used to die on the spot with whatever it had to say unsaid. catching it
859
- # turns the last seconds into a report. only a batch run arms this: on the command line
860
- # SIGTERM must keep killing the process the way the user expects.
861
- def catch_batch_termination(self):
862
- if self.PGLOG['CURBID'] < 1: return
863
- signal.signal(signal.SIGTERM, self.batch_term_handler)
864
-
865
- # park a progress report and then die of the signal that was sent. this runs on borrowed
866
- # time, so it does only what it must: no tar queue counts (two database queries we may
867
- # not get to finish - the done count comes from memory), no dataset unlocking (the
868
- # dscheck daemon already cleans up after a dead pid). the default handler is restored
869
- # first so that a second signal, or the SIGKILL that follows, ends the run outright
870
- # instead of re-entering here should the report hang.
854
+ # park a progress report for a run PBS is about to kill. catch_term_signal() arms this
855
+ # for a batch run only, restores the default handler before calling it, and re-raises
856
+ # the signal afterwards, so all this has to do is build the report.
857
+ # it runs on borrowed time (SIGKILL follows SIGTERM by the MoM's kill_delay, 10 seconds
858
+ # by default), so it does only what it must: no tar queue counts (two database queries
859
+ # we may not get to finish - the done count comes from memory), no dataset unlocking
860
+ # (the dscheck daemon already cleans up after a dead pid).
871
861
  # the report may have to be written from inside an interrupted database call; that is
872
862
  # why it goes through report_dscheck_email, whose cache_customized_email falls back to
873
863
  # sending the mail directly when the UPDATE fails.
874
- def batch_term_handler(self, signum, frame):
875
- signal.signal(signum, signal.SIG_DFL)
876
- # a forked child shares the parent's dscheck record: it must not report for the run
877
- if self.PGSIG['PPID'] > 1: os._exit(1)
878
- if not self.PGBACK['einfo'] and self.PGBACK['doemail'] and self.PGLOG['DSCHECK']:
879
- etime = self.seconds_to_string_time(int(tm() - self.PGBACK['starttime']))
880
- amsg = self.action_message()
881
- dmsg = self.batch_done_count()
882
- wmsg = self.seconds_to_string_time(self.WALLTIME)
883
- self.pglog(self.INDENT + "{}: Terminated by signal {} after {} of the {} PBS walltime, {}".format(
884
- amsg, signum, etime, wmsg, dmsg), self.LOGACT)
885
- self.set_email("{}: {} terminated after {} of the {} PBS walltime, {}!".format(
886
- self.PGBACK['cmd'], amsg, etime, wmsg, dmsg), self.EMLTOP)
887
- title = "dsquasar: {} terminated ({})".format(amsg, dmsg)
888
- if self.PGBACK['errcnt']: title += " Error({})".format(self.PGBACK['errcnt'])
889
- self.report_dscheck_email(title, 1)
890
- os.kill(os.getpid(), signum)
864
+ def batch_term_report(self, signum, frame):
865
+ if self.PGBACK['einfo'] or not (self.PGBACK['doemail'] and self.PGLOG['DSCHECK']): return
866
+ etime = self.seconds_to_string_time(int(tm() - self.PGBACK['starttime']))
867
+ amsg = self.action_message()
868
+ dmsg = self.batch_done_count()
869
+ wmsg = self.seconds_to_string_time(self.WALLTIME)
870
+ self.pglog(self.INDENT + "{}: Terminated by signal {} after {} of the {} PBS walltime, {}".format(
871
+ amsg, signum, etime, wmsg, dmsg), self.LOGACT)
872
+ self.set_email("{}: {} terminated after {} of the {} PBS walltime, {}!".format(
873
+ self.PGBACK['cmd'], amsg, etime, wmsg, dmsg), self.EMLTOP)
874
+ title = "dsquasar: {} terminated ({})".format(amsg, dmsg)
875
+ if self.PGBACK['errcnt']: title += " Error({})".format(self.PGBACK['errcnt'])
876
+ self.report_dscheck_email(title, 1)
891
877
 
892
878
  # email a report for a run under dscheck control. the progress report is parked in
893
879
  # dscheck.einfo and the final report is sent right away. the run holds the check lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_dsquasar
3
- Version: 3.0.20
3
+ Version: 3.0.21
4
4
  Summary: RDA Python package to backup and recover RDA data archives to and from GLOBUS Quasar backup server
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-dsquasar