From 62f0ea5e73ea085638aa26fc2ceac64988b1f1d4 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 15 May 2019 10:08:40 +0200 Subject: [PATCH 1/5] Do not use abs paths in sbatch scripts --- docs/tutorial.rst | 4 ++-- reframe/core/schedulers/__init__.py | 4 ++-- unittests/test_launchers.py | 4 ++-- unittests/test_policies.py | 11 ++++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 43b1458ca9..7e450458bf 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -296,8 +296,8 @@ The generated job script for the test case we are currently inspecting is the fo #SBATCH --job-name="rfm_Example1Test_job" #SBATCH --time=0:10:0 #SBATCH --ntasks=1 - #SBATCH --output=/path/to/stage/daint/gpu/PrgEnv-gnu/Example1Test/rfm_Example1Test_job.out - #SBATCH --error=/path/to/stage/daint/gpu/PrgEnv-gnu/Example1Test/rfm_Example1Test_job.err + #SBATCH --output=rfm_Example1Test_job.out + #SBATCH --error=rfm_Example1Test_job.err #SBATCH --constraint=gpu module load daint-gpu module unload PrgEnv-cray diff --git a/reframe/core/schedulers/__init__.py b/reframe/core/schedulers/__init__.py index 27323cdc3d..a5b3d27453 100644 --- a/reframe/core/schedulers/__init__.py +++ b/reframe/core/schedulers/__init__.py @@ -95,8 +95,8 @@ def __init__(self, self._num_cpus_per_task = num_cpus_per_task self._use_smt = use_smt self._script_filename = script_filename or '%s.sh' % name - self._stdout = stdout or os.path.join(workdir, '%s.out' % name) - self._stderr = stderr or os.path.join(workdir, '%s.err' % name) + self._stdout = stdout or '%s.out' % name + self._stderr = stderr or '%s.err' % name self._time_limit = time_limit self._nodelist = None diff --git a/unittests/test_launchers.py b/unittests/test_launchers.py index f4847e4711..207753e62e 100644 --- a/unittests/test_launchers.py +++ b/unittests/test_launchers.py @@ -126,8 +126,8 @@ def expected_command(self): def expected_minimal_command(self): return ('srun ' '--job-name=fake_job ' - '--output=./fake_job.out ' - '--error=./fake_job.err ' + '--output=fake_job.out ' + '--error=fake_job.err ' '--ntasks=1 ' '--foo') diff --git a/unittests/test_policies.py b/unittests/test_policies.py index 0423dda65d..4af6263e20 100644 --- a/unittests/test_policies.py +++ b/unittests/test_policies.py @@ -183,8 +183,8 @@ def test_pass_in_retries(self): class TaskEventMonitor(executors.TaskEventListener): - """Event listener for monitoring the execution of the asynchronous execution - policy. + """Event listener for monitoring the execution of the asynchronous + execution policy. We need to make sure two things for the async policy: @@ -240,9 +240,10 @@ def read_timestamps(self, tasks): self.begin_stamps = [] self.end_stamps = [] for t in tasks: - with open(evaluate(t.check.stdout), 'r') as f: - self.begin_stamps.append(float(f.readline().strip())) - self.end_stamps.append(float(f.readline().strip())) + with os_ext.change_dir(t.check.stagedir): + with open(evaluate(t.check.stdout), 'r') as f: + self.begin_stamps.append(float(f.readline().strip())) + self.end_stamps.append(float(f.readline().strip())) self.begin_stamps.sort() self.end_stamps.sort() From c43fb390abe96f17311c199dfd20a99c4f7ca8fc Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 15 May 2019 11:59:00 +0200 Subject: [PATCH 2/5] Fix bug on pbs --- reframe/core/schedulers/pbs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reframe/core/schedulers/pbs.py b/reframe/core/schedulers/pbs.py index 632bcbc412..1921d5d2b0 100644 --- a/reframe/core/schedulers/pbs.py +++ b/reframe/core/schedulers/pbs.py @@ -5,6 +5,7 @@ # import os +import pdb import itertools import re import time @@ -101,6 +102,7 @@ def submit(self): cmd = 'qsub -o %s -e %s %s' % (self.stdout, self.stderr, self.script_filename) completed = self._run_command(cmd, settings().job_submit_timeout) + pdb.set_trace() jobid_match = re.search(r'^(?P\S+)', completed.stdout) if not jobid_match: raise JobError('could not retrieve the job id ' @@ -130,7 +132,8 @@ def cancel(self): def finished(self): super().finished() - done = os.path.exists(self.stdout) and os.path.exists(self.stderr) + with os_ext.change_dir(self.workdir): + done = os.path.exists(self.stdout) and os.path.exists(self.stderr) if done: t_now = datetime.now() self._time_finished = self._time_finished or t_now From 7215e840562bcdc4f50a0075a7987fc4b65a2559 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 15 May 2019 12:01:02 +0200 Subject: [PATCH 3/5] Delete pdb import and set trace --- reframe/core/schedulers/pbs.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/reframe/core/schedulers/pbs.py b/reframe/core/schedulers/pbs.py index 1921d5d2b0..fd7a13ca98 100644 --- a/reframe/core/schedulers/pbs.py +++ b/reframe/core/schedulers/pbs.py @@ -5,7 +5,6 @@ # import os -import pdb import itertools import re import time @@ -102,7 +101,6 @@ def submit(self): cmd = 'qsub -o %s -e %s %s' % (self.stdout, self.stderr, self.script_filename) completed = self._run_command(cmd, settings().job_submit_timeout) - pdb.set_trace() jobid_match = re.search(r'^(?P\S+)', completed.stdout) if not jobid_match: raise JobError('could not retrieve the job id ' From d61f1016fe412b278f92089c1935b9a759375e84 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 15 May 2019 13:07:30 +0200 Subject: [PATCH 4/5] Fix sbatch paths in advanced tutorial docs --- docs/advanced.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index a76e90c2ca..71b1a82327 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -300,8 +300,8 @@ The generated job script for this example is the following: #SBATCH --job-name="prerun_demo_check_daint_gpu_PrgEnv-gnu" #SBATCH --time=0:10:0 #SBATCH --ntasks=1 - #SBATCH --output=/path/to/stage/gpu/prerun_demo_check/PrgEnv-gnu/prerun_demo_check.out - #SBATCH --error=/path/to/stage/gpu/prerun_demo_check/PrgEnv-gnu/prerun_demo_check.err + #SBATCH --output=prerun_demo_check.out + #SBATCH --error=prerun_demo_check.err #SBATCH --constraint=gpu module load daint-gpu module unload PrgEnv-cray From eeb61b37b7083bea5657924b0fdf3fce0bfa57b6 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Fri, 17 May 2019 10:34:14 +0200 Subject: [PATCH 5/5] Address PR comments --- reframe/core/schedulers/pbs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/reframe/core/schedulers/pbs.py b/reframe/core/schedulers/pbs.py index fd7a13ca98..96732d3319 100644 --- a/reframe/core/schedulers/pbs.py +++ b/reframe/core/schedulers/pbs.py @@ -132,6 +132,7 @@ def finished(self): super().finished() with os_ext.change_dir(self.workdir): done = os.path.exists(self.stdout) and os.path.exists(self.stderr) + if done: t_now = datetime.now() self._time_finished = self._time_finished or t_now