| 44 | return self._executors.get(execution_id) |
| 45 | |
| 46 | def start_script(self, config, user: User): |
| 47 | audit_name = user.get_audit_name() |
| 48 | |
| 49 | executor = ScriptExecutor(config, self._env_vars) |
| 50 | execution_id = self._id_generator.next_id() |
| 51 | |
| 52 | audit_command = executor.get_secure_command() |
| 53 | LOGGER.info('Calling script #%s: %s', execution_id, audit_command) |
| 54 | |
| 55 | executor.start(execution_id) |
| 56 | self._executors[execution_id] = executor |
| 57 | self._execution_infos[execution_id] = _ExecutionInfo( |
| 58 | execution_id=execution_id, |
| 59 | owner_user=user, |
| 60 | audit_name=audit_name, |
| 61 | audit_command=audit_command, |
| 62 | config=config) |
| 63 | self._active_executor_ids.add(execution_id) |
| 64 | |
| 65 | self._fire_execution_started(execution_id, user) |
| 66 | |
| 67 | self._add_post_finish_handling(execution_id, executor, user) |
| 68 | |
| 69 | return execution_id |
| 70 | |
| 71 | def stop_script(self, execution_id, user): |
| 72 | self.validate_execution_id(execution_id, user) |