Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #90 from rupozzi/utilstime-comdirac
Browse files Browse the repository at this point in the history
Update to new TimeUtilities module
  • Loading branch information
TaykYoku authored Jun 11, 2022
2 parents ebe3b4a + 64270b9 commit bff3e11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/COMDIRAC/Interfaces/scripts/dinput.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""
Retrieve input sandbox for a DIRAC job
"""

import DIRAC
from DIRAC.Core.Base.Script import Script

import os
import pprint
import datetime


class Params:
Expand Down Expand Up @@ -89,7 +91,7 @@ def main():
jobIDs = Script.getPositionalArgs()

from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.Core.Utilities.Time import toString, date, day
from DIRAC.Core.Utilities.TimeUtilities import toString, day

dirac = Dirac()
exitCode = 0
Expand All @@ -107,7 +109,7 @@ def main():
jobIDs += l.split(",")

for jobGroup in params.getJobGroup():
jobDate = toString(date() - 30 * day)
jobDate = toString(datetime.datetime.utcnow().date - 30 * day)

# Choose jobs no more than 30 days old
result = dirac.selectJobs(jobGroup=jobGroup, date=jobDate)
Expand Down
5 changes: 3 additions & 2 deletions src/COMDIRAC/Interfaces/scripts/doutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from DIRAC.Core.Base.Script import Script

import os
import datetime


class Params:
Expand Down Expand Up @@ -107,7 +108,7 @@ def main():
args = Script.getPositionalArgs()

from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.Core.Utilities.Time import toString, date, day
from DIRAC.Core.Utilities.TimeUtilities import toString, day

dirac = Dirac()
exitCode = 0
Expand All @@ -125,7 +126,7 @@ def main():
args += l.split(",")

for jobGroup in params.getJobGroup():
jobDate = toString(date() - 30 * day)
jobDate = toString(datetime.datetime.utcnow().date() - 30 * day)

# Choose jobs in final state, no more than 30 days old
for s in ["Done", "Failed"]:
Expand Down
5 changes: 4 additions & 1 deletion src/COMDIRAC/Interfaces/scripts/dstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Retrieve status of DIRAC jobs
"""
import datetime
from signal import signal, SIGPIPE, SIG_DFL

from DIRAC import exit as DIRACExit, S_OK, S_ERROR
Expand Down Expand Up @@ -232,7 +233,9 @@ def main():

if not jobs:
# time interval
jobDate = toString(date() - params.getJobDate() * day)
jobDate = toString(
datetime.datetime.utcnow().date() - params.getJobDate() * day
)

# job owner
userName = params.getUser()
Expand Down

0 comments on commit bff3e11

Please sign in to comment.