Esempio n. 1
0
 def get_subprocess(self, cmd, params):
     Subprocess = subprocess_factory(cmd)
     if 'group' in params:
         self.check_group(params['group'])
     if 'node_backend' in params:
         self.check_node_backend(params['node_backend'])
     return Subprocess
Esempio n. 2
0
    def status(self):
        cmd = (shlex.split(self.command.encode('utf-8'))
               if isinstance(self.command, basestring) else
               self.command)
        Subprocess = subprocess.subprocess_factory(cmd)
        if issubclass(Subprocess, BaseSubprocess):
            Watcher = Subprocess.watcher_base
            exit_message = Watcher.exit_messages.get(self.exit_code, 'Unknown')
        else:
            exit_message = 'Success' if self.exit_code == 0 else ''

        artifacts = {}
        try:
            artifacts = json.loads(self.artifacts)
        except ValueError as e:
            logger.error('Dumped command (uid {}) has mailformed "artifacts" field: {}'.format(
                self.uid,
                self.artifacts
            ))
            pass

        return {
            'pid': self.pid,
            'command': self.command,
            'task_id': self.task_id,
            'progress': self.progress,
            'exit_code': self.exit_code,
            'exit_message': exit_message,
            'command_code': self.command_code,
            'start_ts': self.start_ts,
            'finish_ts': self.finish_ts,
            'output': self.stdout,
            'error_output': self.stderr,
            'artifacts': artifacts,
        }
Esempio n. 3
0
 def get_subprocess(self, cmd, params):
     Subprocess = subprocess_factory(cmd)
     if 'group' in params:
         self.check_group(params['group'])
     if 'node_backend' in params:
         self.check_node_backend(params['node_backend'])
     return Subprocess
Esempio n. 4
0
 def get_subprocess(self, cmd, params):
     Subprocess = subprocess_factory(cmd)
     if issubclass(Subprocess, RsyncSubprocess):
         self.check_group(params.get('group', 0))
     elif issubclass(Subprocess, (DnetIoclientSubprocess, UbicSubprocess)):
         self.check_node(params.get('node'), params.get('node_backend'))
     return Subprocess
Esempio n. 5
0
 def get_subprocess(self, cmd, params):
     Subprocess = subprocess_factory(cmd)
     if issubclass(Subprocess, RsyncSubprocess):
         self.check_group(params.get('group', 0))
     elif issubclass(Subprocess, (DnetIoclientSubprocess, UbicSubprocess)):
         self.check_node(params.get('node'), params.get('node_backend'))
     return Subprocess
Esempio n. 6
0
 def status(self):
     cmd = (shlex.split(self.command.encode('utf-8'))
            if isinstance(self.command, basestring) else
            command)
     Subprocess = subprocess.subprocess_factory(cmd)
     Watcher = Subprocess.watcher_base
     return {
         'pid': self.pid,
         'command': self.command,
         'task_id': self.task_id,
         'progress': self.progress,
         'exit_code': self.exit_code,
         'exit_message': Watcher.exit_messages.get(self.exit_code, 'Unknown'),
         'command_code': self.command_code,
         'start_ts': self.start_ts,
         'finish_ts': self.finish_ts,
         'output': '',
         'error_output': '',
     }
Esempio n. 7
0
 def status(self):
     cmd = (shlex.split(self.command.encode('utf-8')) if isinstance(
         self.command, basestring) else command)
     Subprocess = subprocess.subprocess_factory(cmd)
     Watcher = Subprocess.watcher_base
     return {
         'pid': self.pid,
         'command': self.command,
         'task_id': self.task_id,
         'progress': self.progress,
         'exit_code': self.exit_code,
         'exit_message': Watcher.exit_messages.get(self.exit_code,
                                                   'Unknown'),
         'command_code': self.command_code,
         'start_ts': self.start_ts,
         'finish_ts': self.finish_ts,
         'output': '',
         'error_output': '',
     }
Esempio n. 8
0
    def status(self):
        cmd = (shlex.split(self.command.encode('utf-8')) if isinstance(
            self.command, basestring) else self.command)
        Subprocess = subprocess.subprocess_factory(cmd)
        if issubclass(Subprocess, BaseSubprocess):
            Watcher = Subprocess.watcher_base
            exit_message = Watcher.exit_messages.get(self.exit_code, 'Unknown')
        else:
            exit_message = 'Success' if self.exit_code == 0 else ''

        artifacts = {}
        try:
            artifacts = json.loads(self.artifacts)
        except ValueError as e:
            cmd_logger.error(
                'Dumped command (uid {}) has mailformed "artifacts" field: {}'.
                format(self.uid, self.artifacts),
                extra={
                    'task_id': self.task_id,
                    'job_id': self.job_id
                },
            )
            pass

        return {
            'pid': self.pid,
            'command': self.command,
            'job_id': self.job_id,
            'task_id': self.task_id,
            'progress': self.progress,
            'exit_code': self.exit_code,
            'exit_message': exit_message,
            'command_code': self.command_code,
            'start_ts': self.start_ts,
            'finish_ts': self.finish_ts,
            'output': self.stdout,
            'error_output': self.stderr,
            'artifacts': artifacts,
        }