Skip to content

Commit

Permalink
Merge pull request #54 from BNLNPPS/shrek-summary-dump
Browse files Browse the repository at this point in the history
[logging] Dump shrek submission parameters into json file or stdout
  • Loading branch information
klendathu2k authored Mar 9, 2023
2 parents 2962c98 + ec0fa0e commit 68f4730
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions shrek/scripts/submitWorflowToPanDA.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import pprint
import inspect
import logging
import json
from io import StringIO

#import cProfile
Expand Down Expand Up @@ -221,6 +222,9 @@ def main():
parser.add_argument('--group', type=str, default="" )
parser.add_argument('--branch', type=str, default=shrekOpts['defaultBranch'])

#
parser.add_argument('--dump-file', dest="dumpfile", type=str, default=None )

# Unrecognized flags
args, globalvars = parser.parse_known_args()

Expand Down Expand Up @@ -256,6 +260,7 @@ def main():
WARN("Possibly non-unique tag %s"%taguuid)
pass


shrekOpts['taguuid'] = taguuid

(subdir,cwlfile,yamlfile,jobs) = buildSubmissionDirectory( taguuid, args.yaml, args.site, args, shrekOpts, glvars )
Expand Down Expand Up @@ -456,6 +461,22 @@ def main():
doit.write('%s=%s\n'%(k,v))
doit.write( '%s\n'% ' '.join(pchain) )


if args.dumpfile:
todump = {
'args' : vars(args),
'shrek' : shrekOpts,
'panda' : pandaOpts
}

if args.dumpfile=="stdout":
INFO("--BEGIN-SHREK-SUMMARY--")
pprint.pprint( todump )
INFO("--END-SHREK-SUMMARY--")
else:
with open(args.dumpfile,'w') as f:
pprint.pprint( todump, f )

if __name__ == '__main__':

#cProfile.run("main()",sort="cumtime")
Expand Down

0 comments on commit 68f4730

Please sign in to comment.