Commit 55e8f91f authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Accept a plus sign for specifying the job ranges

parent 8ee43071
Pipeline #21972 passed with stage
in 8 minutes and 56 seconds
......@@ -170,11 +170,13 @@ which will list only the jobs of the given job id(s):
$ jman -vv list -a -j [job_id_1] [job_id_2]
Note that the ``-j`` option is in general relatively smart. You can use it to
select a range of job ids, e.g., ``-j 1-4 6-8``. In this case, please assert
that there are no spaces between job ids and the ``-`` separator. If any job
id is specified, which is not available in the database, it will simply be
ignored, including job ids that in the ranges.
Note that the ``-j`` option is in general relatively smart. You can use it to
select a range of job ids, e.g., ``-j 1-4 6-8 10+2`` is the same as
``-j 1 2 3 4 6 7 8 10 11 12``. In this case, please assert that there are no
spaces between job ids and the ``-`` and ``+`` separators. You cannot use both
``-`` and ``+`` in one part, i.e., something like ``-j 1-4+2`` will not work.
If any job id is specified, which is not available in the database, it will
simply be ignored, including job ids that are in the ranges.
Since version 1.3.0, GridTK also saves timing information about jobs, i.e.,
time stamps when jobs were submitted, started and finished. You can use the
......
......@@ -80,15 +80,18 @@ def get_ids(jobs):
return None
indexes = []
for job in jobs:
# check if a range is specified
separator = job.find('-')
if separator == -1:
if '-' not in job and '+' not in job:
index = int(job)
indexes.append(index)
else:
first = int(job[0:separator])
last = int(job[separator+1:])
indexes.extend(range(first, last+1))
# check if a range is specified
elif '-' in job and '+' not in job:
first, last = job.split('-', 1)
indexes.extend(range(int(first), int(last) + 1))
# check if a plus sign is specified
elif '+' in job and '-' not in job:
first, add = job.split('+', 1)
first, add = int(first), int(add)
indexes.extend(range(first, first + add + 1))
return indexes
......
......@@ -117,7 +117,7 @@ class GridTKTest(unittest.TestCase):
self.scheduler_job = subprocess.Popen([self.jman, '--local', '--database', self.database, 'run-scheduler', '--sleep-time', '5', '--parallel', '2'])
# sleep some time to assure that the scheduler was able to start the first job
time.sleep(4)
time.sleep(5)
# ... and kill the scheduler
self.scheduler_job.kill()
self.scheduler_job = None
......@@ -153,7 +153,7 @@ class GridTKTest(unittest.TestCase):
self.scheduler_job = subprocess.Popen([self.jman, '--local', '--database', self.database, 'run-scheduler', '--sleep-time', '5', '--parallel', '2'])
# sleep some time to assure that the scheduler was able to finish the first and start the second job
time.sleep(9)
time.sleep(10)
# ... and kill the scheduler
self.scheduler_job.kill()
self.scheduler_job = None
......@@ -246,7 +246,7 @@ class GridTKTest(unittest.TestCase):
jman.main([self.jman, '--database', self.database, 'report'])
# clean-up
jman.main([self.jman, '--local', '--database', self.database, 'delete', '--job-ids', '1-5'])
jman.main([self.jman, '--local', '--database', self.database, 'delete', '--job-ids', '1+4'])
# check that the database and the log files are gone
self.assertEqual(len(os.listdir(self.temp_dir)), 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment