spacr.qt.screens.distributed_jobs

Configure, submit and monitor remote/distributed spaCR jobs.

Every network and scheduler call runs through make_thread(); the GUI thread only updates controls and renders already-returned records.

Classes

DistributedJobsScreen

Submit and monitor distributed spaCR jobs without blocking Qt.

ExecutionProfileDialog

Create or edit one distributed execution profile.

Module Contents

class spacr.qt.screens.distributed_jobs.DistributedJobsScreen(parent=None, *, manager: spacr.remote_execution.RemoteJobManager | None = None, threaded: bool = True, auto_poll: bool = True)[source]

Bases: PySide6.QtWidgets.QWidget

Submit and monitor distributed spaCR jobs without blocking Qt.

Parameters:
  • parent – parent widget.

  • manager – the job manager to submit through. One is created when none is given, so a test can supply a manager that reaches no cluster.

  • threaded – whether submissions and polls run off the GUI thread. False runs them inline, which is what makes a test deterministic.

  • auto_poll – whether the screen starts its own refresh timer. False leaves the job list to be refreshed by hand, so a test is not racing a timer it did not start.

Build the screen and arm its drop zone and poll timer.

A store that cannot be read reports itself on the status line and leaves the screen usable with no jobs listed, rather than failing to build – the profiles half still works and is how the store gets fixed.

Parameters:
  • parent – parent widget, or None.

  • manager – the remote job manager; None opens the default one.

  • threaded – run submissions and polls on a worker thread.

  • auto_poll – start the refresh timer. Off in tests, which drive refresh themselves.

cancel_selected() → None[source]

Request cancellation for the selected active job.

closeEvent(event) → None[source]

Stop polling and drain live workers before the screen goes away.

requestInterruption on its own was decorative — _work never polls it — and left the screen’s REST calls running with nobody owning them. An ownerless job stays in the process-wide run registry, which is what MainWindow.closeEvent consults when it decides whether the application may quit.

Parameters:

event – the close event; it is passed on unchanged to the base-class handler after the workers are drained.

configure_submission(module: str, settings: dict) → None[source]

Preload an immutable settings snapshot handed off by an AppScreen.

Parameters:
  • module – the spacr.cli.MODULES key to select in the module box; an unknown key leaves the selection unchanged.

  • settings – the settings to submit; a shallow copy is kept and used instead of a settings file until the path field is edited.

hideEvent(event) → None[source]

Stop background polling when another module is open.

Parameters:

event – the hide event; passed on unchanged to the base class.

refresh() → None[source]

Poll all non-terminal jobs in a worker thread.

refresh_log() → None[source]

Fetch the selected job’s remote log tail.

showEvent(event) → None[source]

Poll only while this screen is visible.

Parameters:

event – the show event; passed on unchanged to the base class before polling restarts (when auto-polling is on).

submit() → None[source]

Resolve and submit the selected settings file.

class spacr.qt.screens.distributed_jobs.ExecutionProfileDialog(parent=None, profile: spacr.remote_execution.ExecutionProfile | None = None)[source]

Bases: PySide6.QtWidgets.QDialog

Create or edit one distributed execution profile.

Parameters:
  • parent – parent widget.

  • profile – the profile to edit. None CREATES one – the dialog is both routes, which is why it is not two classes.

Build the execution-profile editor.

Parameters:
  • parent – parent widget, or None.

  • profile – the profile to edit; None starts a new one. Its original name is kept so a rename can be told from a new profile.

profile() → spacr.remote_execution.ExecutionProfile[source]

Return the currently entered, validated profile.

Nested helpers

DistributedJobsScreen._start_task._work(_settings)

Run the operation on the job runner’s thread.

spacr/qt/screens/distributed_jobs.py:757

DistributedJobsScreen.cancel_selected._done(updated)

Redraw with the cancelled job still selected.

Keeping the SELECTION is the point: a list that jumps to the top after a cancel loses the row the user was working with.

spacr/qt/screens/distributed_jobs.py:916

DistributedJobsScreen.refresh._done(jobs)

Redraw the job list and report how many are still active.

spacr/qt/screens/distributed_jobs.py:867

DistributedJobsScreen.refresh_log._done(text)

Show the fetched log, re-reading the job in case it moved on.

spacr/qt/screens/distributed_jobs.py:942

DistributedJobsScreen.submit._done(job: RemoteJob)

Redraw the job list with the new job selected.

spacr/qt/screens/distributed_jobs.py:854

DistributedJobsScreen.submit._submit()

Resolve the module and its settings, then submit. Off-thread.

spacr/qt/screens/distributed_jobs.py:836