def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.update( do_not_send=False, opId=job.unique_key(), send_ready=tornado.locks.Event(), _reply_q=tornado.queues.Queue(), ) self.msg.update(opId=self.opId, opName=self.opName)
def make_lib_dir_symlink(self, op): m = op.msg with sirepo.auth.set_user(m.uid): d = sirepo.simulation_db.simulation_lib_dir(m.simulationType) op.lib_dir_symlink = job.LIB_FILE_ROOT.join(job.unique_key()) op.lib_dir_symlink.mksymlinkto(d, absolute=True) m.pkupdate( libFileUri=job.supervisor_file_uri( self.cfg.supervisor_uri, job.LIB_FILE_URI, op.lib_dir_symlink.basename, ), libFileList=[f.basename for f in d.listdir()], )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.update( do_not_send=False, internal_error=None, opId=job.unique_key(), run_dir_slot=self.computeJob.run_dir_slot_q.sr_slot_proxy(self), _reply_q=sirepo.tornado.Queue(), ) self.msg.update(opId=self.opId, opName=self.opName) self.driver = job_driver.assign_instance_op(self) self.cpu_slot = self.driver.cpu_slot_q.sr_slot_proxy(self) q = self.driver.op_slot_q.get(self.opName) self.op_slot = q and q.sr_slot_proxy(self) self.max_run_secs = self._get_max_run_secs() pkdlog('{} runDir={}', self, self.msg.get('runDir'))
def make_lib_dir_symlink(self, op): if not self._has_remote_agent(): return m = op.msg d = pykern.pkio.py_path(m.simulation_lib_dir) op.lib_dir_symlink = job.LIB_FILE_ROOT.join( job.unique_key() ) op.lib_dir_symlink.mksymlinkto(d, absolute=True) m.pkupdate( libFileUri=job.supervisor_file_uri( self.cfg.supervisor_uri, job.LIB_FILE_URI, op.lib_dir_symlink.basename, ), libFileList=[f.basename for f in d.listdir()], )
def __init__(self, req): super().__init__( kind=req.kind, ops_pending_done=PKDict(), ops_pending_send=[], uid=req.content.uid, websocket=None, _agentId=job.unique_key(), _agent_starting=False, ) # Agents persist for the life of the program so they are never removed self.agents[self._agentId] = self pkdlog( 'class={} agentId={_agentId} kind={kind} uid={uid}', self.__class__.__name__, **self )
def __init__(self, op): super().__init__( driver_details=PKDict({'type': self.__class__.__name__}), kind=op.kind, ops=PKDict(), #TODO(robnagler) sbatch could override OP_RUN, but not OP_ANALYSIS # because OP_ANALYSIS touches the directory sometimes. Reasonably # there should only be one OP_ANALYSIS running on an agent at one time. op_slot_q=PKDict({k: job_supervisor.SlotQueue() for k in OPS_THAT_NEED_SLOTS}), uid=op.msg.uid, _agentId=job.unique_key(), _agent_start_lock=tornado.locks.Lock(), _agent_starting_timeout=None, _websocket=None, _websocket_ready=tornado.locks.Event(), #TODO(robnagler) https://github.com/radiasoft/sirepo/issues/2195 ) # Drivers persist for the life of the program so they are never removed self.__instances[self._agentId] = self pkdlog('{}', self)
def _create_in_file(self): f = self.run_dir.join(_IN_FILE.format(job.unique_key()), ) pkjson.dump_pretty(self.msg, filename=f, pretty=False) return f