diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-08-28 10:36:01 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-08-28 10:36:01 -0500 |
commit | 169f148f885ddcd3697656129fd01968853a21de (patch) | |
tree | 1ffde1e4d07ace4590fded10bcb51582b88a761f /utils | |
parent | 5433b759755be73c7d7f39bcbb331a23f6423ca7 (diff) | |
download | sddm-169f148f885ddcd3697656129fd01968853a21de.tar.gz sddm-169f148f885ddcd3697656129fd01968853a21de.tar.bz2 sddm-169f148f885ddcd3697656129fd01968853a21de.zip |
update submit-grid-jobs to use my version of splitext
This commit updates the submit-grid-jobs script to use my version of splitext()
which removes the full extension from the filename. This fixes an issue where
the output HDF5 files had xzdab in the name whenever the input file had the
file extension .xzdab.gz.
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/submit-grid-jobs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/utils/submit-grid-jobs b/utils/submit-grid-jobs index a55a723..1fa015b 100755 --- a/utils/submit-grid-jobs +++ b/utils/submit-grid-jobs @@ -21,7 +21,7 @@ try: except ImportError: from yaml.loader import SafeLoader as Loader import string -from os.path import split, splitext, join, abspath +from os.path import split, join, abspath import uuid from subprocess import check_call import os @@ -140,6 +140,24 @@ ID = uuid.uuid1() class MyTemplate(string.Template): delimiter = '@' +def splitext(path): + """ + Like os.path.splitext() except it returns the full extension if the + filename has multiple extensions, for example: + + splitext('foo.tar.gz') -> 'foo', '.tar.gz' + """ + full_root, full_ext = os.path.splitext(path) + while True: + root, ext = os.path.splitext(full_root) + if ext: + full_ext = ext + full_ext + full_root = root + else: + break + + return full_root, full_ext + def submit_job(filename, run, gtid, dir, dqxx_dir, min_nhit, max_particles, particle_combo=None): print("submitting job for %s gtid %i" % (filename, gtid)) head, tail = split(filename) |