Commit b93f1053 authored by Wout De Nolf's avatar Wout De Nolf

[JobFactory] setters for name and log_base

parent 29c77a38
......@@ -55,7 +55,7 @@ class Job(object):
self._jobid = jobid
self._fixed_stats = None
"""Used to store store stats when using the `fixed_stats` context
"""Used to store stats when using the `fixed_stats` context
......@@ -136,7 +136,7 @@ class Job(object):
:param silent: if False then write to stdout advancement ('.')
# make sure _until will always be iterable (dea with str, bytes...)
# make sure _until will always be iterable (deal with str, bytes...)
_states = states
if isinstance(_states, (tuple, list, dict)) is False:
_states = (_states,)
......@@ -392,18 +392,41 @@ class JobFactory(object):
def __init__(self, command=None, resource=None, name=None, project=None,
working_directory=None, log_directory=None, log_base=None):
self._name = None
self._log_base = None
self.command = command
self.resource = resource = name
self.project = project
self.working_directory = working_directory
self.log_directory = log_directory
if log_base:
self.log_base = log_base
self.log_base = log_base
def name(self):
return self._name
def name(self,value):
self._name = value
def log_base(self):
return self._log_base
def log_base(self,value):
if value:
self._log_base = value
self.log_base = '%jobname%.%jobid%'
if not and '%jobname%' in self.log_base: = 'OAR'
self._log_base = '%jobname%.%jobid%'
def _default_name(self):
if not and self.log_base:
if '%jobname%' in self.log_base: = 'OAR'
def cli_arguments(self):
......@@ -114,7 +114,7 @@ class test_oarjob(unittest.TestCase):
job = jobdef.submit()
job.wait(states=('Running', 'Terminated', 'Error'), silent=True)
self.assertRaises(RuntimeError, job.suspend)
#job.wait_needsresume(states=('Hold', 'Suspended'), silent=True)
#job.wait(states=('Hold', 'Suspended'), silent=True)
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