def init_cml(self, command, is_run_background=False, is_nohup=False, workdirpath=None): self.optiongroupname = 'cml-options' self.optiongroupnames.append(self.optiongroupname) attrsman = self.get_attrsman() self.pathmetatypes = ['filepath', 'dirpath', 'filepaths', 'dirpaths'] self.workdirpath = workdirpath self._command = attrsman.add( cm.AttrConf('_command', command, groupnames=['_private'], perm='r', name='command', info='Command to be executed.')) self.pid = attrsman.add( cm.AttrConf( 'pid', -1, groupnames=['_private'], perm='r', name='Process ID', info="The system's Process ID", )) self.is_run_background = attrsman.add( cm.AttrConf( 'is_run_background', is_run_background, groupnames=['parameters', 'advanced'], perm='rw', name='Run in background', info='If set, process will run in background.', )) self.is_nohup = attrsman.add( cm.AttrConf( 'is_nohup', is_nohup, groupnames=[ 'parameters', 'advanced', ], perm='rw', name='No hangup', info= """If set, process will run in the background and will continue to run after logout. (Currently on UNIX platforms only.) """, ))
def _init_common(self, ident, parent=None, name=None, **kwargs): self._init_objman(ident=ident, parent=parent, name=name, **kwargs) attrsman = self.set_attrsman(cm.Attrsman(self)) self.optiongroupnames = ['options'] #self.net = attrsman.add( cm.ObjConf( network.Network(self) ) ) self.status = attrsman.add( cm.AttrConf( 'status', 'preparation', groupnames=['_private', 'parameters'], perm='r', name='Status', info='Process status: preparation-> running -> success|error.') )
def add_option(self, option, value, **kwargs): kwargs0 = { 'cml': None, 'groupnames': [], 'perm': 'rw', 'is_save': True, 'name': None, 'info': '', } kwargs0.update(kwargs) if not (self.optiongroupname in kwargs0['groupnames']): kwargs0['groupnames'] += [self.optiongroupname] # print '\nadd_option', option, value,kwargs0 default = self.get_attrsman().add(cm.AttrConf(option, value, **kwargs0)) setattr(self, option, default)
def add_option(self, option, value, **kwargs): """ option = string with option value = value of option name = human readable name info = help info cml = string to be specified if command line string different from option """ kwargs0 = { 'cml': None, 'groupnames': [], 'perm': 'rw', 'is_save': True, 'name': None, 'info': '', } kwargs0.update(kwargs) if not ('options' in kwargs0['groupnames']): kwargs0['groupnames'] += ['options'] default = self.attrs.add(cm.AttrConf(option, value, **kwargs0)) setattr(self, option, default)
def __init__(self, ident, command=None, parent=None, name=None, is_inputfilelist=True, is_outputfilelist=True, is_force=False, is_run_background=False, is_nohup=False, workdirpath=None): self._init_objman(ident, parent=parent, name=name) self.attrs = self.set_attrman(cm.AttrsManager(self, 'attrs')) if command == None: command_default = '' else: command_default = command self.set_workdirpath(workdirpath) self.status = self.attrs.add( cm.AttrConf( 'status', 'preparation', groupnames=['parameters'], perm='r', metatype='internal', name='Status', info='Process status: preparation-> running -> success|error.') ) self._command = self.attrs.add( cm.AttrConf('_command', command_default, groupnames=['parameters', '_private', 'advanced'], perm='r', metatype='internal', name='command', info='Command to be executed.')) self.progress = self.attrs.add( cm.AttrConf( 'progress', 0.0, groupnames=['parameters'], perm='r', metatype='progress', unit='%', name='Progress', info='Indicates the percentage of completion of the process.')) self.pid = self.attrs.add( cm.AttrConf( 'pid', -1, groupnames=['parameters', 'advanced'], perm='r', name='Process ID', info="The system's Process ID", )) self.is_force = self.attrs.add( cm.AttrConf( 'is_force', is_force, groupnames=['parameters', 'advanced'], perm='rw', name='is_force', info= 'If set, process will be executed even if output files exist.', )) self.is_run_background = self.attrs.add( cm.AttrConf( 'is_run_background', is_run_background, groupnames=['parameters', 'advanced'], perm='rw', name='Run in background', info='If set, process will run in background.', )) self.is_nohup = self.attrs.add( cm.AttrConf( 'is_nohup', is_nohup, groupnames=['parameters', 'advanced'], perm='rw', name='No hangup', info= """If set, process will run in the background and will continue to run after logout. (Currently on UNIX platforms only.) """, )) if is_inputfilelist: self.files_input = self.add_tableman( cm.TableManager(ident='files_input', parent=self, name='Input files', is_keyindex=True), ) self.files_input.add( cm.DictConf( 'filename', '', groupnames=['input'], perm='rw', name='Name', info='File name of input file', )) self.files_input.add( cm.DictConf( 'is_existent', False, groupnames=['output'], perm='r', name='Exists?', info='If set, this input file is exists.', )) self.files_input.add( cm.DictConf( 'is_required', True, groupnames=['output'], perm='r', name='Required?', info='If set, this input file is required.', )) self.files_input.add( cm.DictConf( 'filepath', '', groupnames=['input'], perm='rw', metatype='filepath', name='Path', info='Filepath of input file', )) self.files_input.add( cm.DictConf( 'fileoption', '', groupnames=['input', 'advanced'], perm='r', name='Option', info='Command line option', )) self.files_input.add( cm.DictConf( 'fileinfo', '', groupnames=['input', 'advanced'], perm='rw', name='Info', info='File info of input file', )) self.files_input.add( cm.DictConf( 'wildcards', '', groupnames=['input', 'advanced'], perm='rw', name='wildcards', info='Wildcards for file filtering', )) if is_outputfilelist: self.files_output = self.add_tableman( cm.TableManager(ident='files_output', parent=self, name='Output files', is_keyindex=True), ) self.files_output.add( cm.DictConf( 'filename', '', groupnames=['output'], perm='rw', name='Name', info='File name of output file', )) self.files_output.add( cm.DictConf( 'filepath', '', groupnames=['output'], perm='rw', metatype='filepath', name='Path', info='Filepath of output file', )) self.files_output.add( cm.DictConf( 'fileoption', '', groupnames=['advanced'], perm='r', name='Option', info='Command line option', )) self.files_output.add( cm.DictConf( 'fileinfo', '', groupnames=['output', 'advanced'], perm='r', is_save=True, name='Info', info='File info of output file', )) self.files_output.add( cm.DictConf( 'wildcards', '', groupnames=['output', 'advanced'], perm='rw', is_save=True, name='wildcards', info='Wildcards for file filtering', ))