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

[2.0] Update to new TimeUtilities module #90

Merged
merged 2 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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