diff --git a/doc/manual.rst b/doc/manual.rst index c099dce25546845e968b3b5d7aa935ab07542f8d..1bc852357c1035abf86b3b5a73cb74eab394e4b6 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -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 diff --git a/gridtk/script/jman.py b/gridtk/script/jman.py index a3ff027816281802c997b36d932cb2729cebf8a4..de0ae0a5caacc314cd242dbe9e94a0973e7a3f8a 100644 --- a/gridtk/script/jman.py +++ b/gridtk/script/jman.py @@ -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 diff --git a/gridtk/tests/__init__.py b/gridtk/tests/__init__.py index 3d0083769887b869aeacdec2b271e35b1f826ed3..f89e10097e66efd133360108f41a1929247fcf3c 100644 --- a/gridtk/tests/__init__.py +++ b/gridtk/tests/__init__.py @@ -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)