diff --git a/OpenOrchestrator/orchestrator/tabs/logging_tab.py b/OpenOrchestrator/orchestrator/tabs/logging_tab.py index 4e9fa07..7fa0f81 100644 --- a/OpenOrchestrator/orchestrator/tabs/logging_tab.py +++ b/OpenOrchestrator/orchestrator/tabs/logging_tab.py @@ -25,6 +25,7 @@ class LoggingTab(): """The 'Logs' tab object.""" def __init__(self, tab_name: str) -> None: self.current_job_id: str | None = None + # TODO: Serverside pagination like queue tab maybe? with ui.tab_panel(tab_name): with ui.row().classes("w-full justify-between"): with ui.row(): diff --git a/OpenOrchestrator/orchestrator/tabs/queue_tab.py b/OpenOrchestrator/orchestrator/tabs/queue_tab.py index 32753b4..4de1e39 100644 --- a/OpenOrchestrator/orchestrator/tabs/queue_tab.py +++ b/OpenOrchestrator/orchestrator/tabs/queue_tab.py @@ -93,7 +93,7 @@ def __init__(self, queue_name: str, update_callback): ui.switch("Dense", on_change=lambda e: self._dense_table(e.value)) self._create_column_filter() ui.button(icon='refresh', on_click=self._update) - self.close_button = ui.button(icon="close", on_click=dialog.close) + self.close_button = ui.button(icon="close", on_click=lambda: (dialog.close(), self.update_callback())) with ui.scroll_area().classes("h-full"): self.table = ui.table(columns=ELEMENT_COLUMNS, rows=[], row_key='ID', title=queue_name, pagination={'rowsPerPage': self.rows_per_page, 'rowsNumber': self.queue_count}).classes("w-full sticky-header h-[calc(100vh-200px)] overflow-auto") self.table.on('rowClick', lambda e: self._open_queue_element_popup(e.args[1])) @@ -105,7 +105,6 @@ def __init__(self, queue_name: str, update_callback): self.new_button = ui.button(icon='playlist_add', on_click=self._open_create_dialog) self._update() - self.update_callback() test_helper.set_automation_ids(self, "queue_popup") def _dense_table(self, value: bool): diff --git a/OpenOrchestrator/scheduler/runner.py b/OpenOrchestrator/scheduler/runner.py index 3fbf8a7..231dcd0 100644 --- a/OpenOrchestrator/scheduler/runner.py +++ b/OpenOrchestrator/scheduler/runner.py @@ -213,6 +213,11 @@ def kill_job(job: SchedulerJob) -> None: Args: job: The job whose process to kill. """ + # Kill process tree to ensure child processes (like browsers or subprocesses) are also killed + # WARNING: This will cause an error on non-Windows systems + subprocess.run(['taskkill', '/F', '/T', '/PID', str(job.process.pid)], + check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + job.process.kill() db_util.set_trigger_status(job.trigger.id, TriggerStatus.KILLED) db_util.set_job_status(job.job.id, JobStatus.KILLED) @@ -261,7 +266,7 @@ def run_process(trigger: Trigger) -> SchedulerJob | None: conn_string = db_util.get_conn_string() crypto_key = crypto_util.get_key() - command_args = ['python', process_path, trigger.process_name, conn_string, crypto_key, trigger.process_args, str(trigger.id), job.id] + command_args = ['python', process_path, trigger.process_name, conn_string, crypto_key, trigger.process_args, str(trigger.id), str(job.id)] process = subprocess.Popen(command_args, stderr=subprocess.PIPE, text=True) # pylint: disable=consider-using-with @@ -275,7 +280,7 @@ def run_process(trigger: Trigger) -> SchedulerJob | None: db_util.set_trigger_status(trigger.id, TriggerStatus.FAILED) error_msg = f"Scheduler couldn't launch the process:\n{exc.__class__.__name__}:\n{exc}" db_util.create_log(trigger.process_name, LogLevel.ERROR, None, error_msg) - db_util.set_job_status(job, JobStatus.FAILED) + db_util.set_job_status(job.id, JobStatus.FAILED) print(error_msg) return None diff --git a/changelog.md b/changelog.md index 1908036..a0036a5 100644 --- a/changelog.md +++ b/changelog.md @@ -13,15 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the possibility to kill a running robot from Orchestrator. - Added search and status filter to queue element list. - Added overview of queue element. -- Added search and status filter to queue element list. -- Added overview of queue element. -- Added option to create new queue element. -- Added editing of queue elements. -- Added option to delete queue element.- Added search and status filter to queue element list. -- Added overview of queue element. - Added option to create new queue element. - Added editing of queue elements. - Added option to delete queue element. +- Added search and status filter to queue element list. - Added Job objects, job tabs and linked logs to jobs. ### Changed