diff options
Diffstat (limited to 'utils/submit-grid-jobs')
-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) |