Batch Management GUI

qalx-OrcaFlex comes with a graphical user interface(GUI) that provides batch overview and management functionality. For a given batch that has been saved on qalx, there are two ways to instantiate this GUI and these are explained below:

From a batch waiter

There is an option in a batch waiter run_with_gui which can be set to True and this will instantiate the GUI for the batch that has been submitted:

import OrcFxAPI as ofx

import qalx_orcaflex.data_models as dm
from qalx_orcaflex.core import QalxOrcaFlex, OrcaFlexBatch, ModelSource, \
    DirectorySource, FileSource

qfx = QalxOrcaFlex()
batch_options = dm.BatchOptions(
    batch_queue="batch bot",
    sim_queue="sim bot",
)
m = ofx.Model()
line = m.CreateObject(ofx.otLine, "My Line")

with OrcaFlexBatch(name="My Batch", session=qfx,
                   batch_options=batch_options) as batch:
    for length in [100, 120]:
        line.Length[0] = length
        batch.add(ModelSource(m, f"Case l={length}"))
    batch.add(DirectorySource(r"S:\Project 123\OFX\140-160m models"))
    batch.add(FileSource(r"C:\User\AnneAlysis\My Models\180m.dat"))
with batch.when_complete(
    interval=20, timeout=1*60*60, run_with_gui=True
):
    pass

In the code snippet above, the waiter will execute the GUI and this can be used to visualise the state of the batch.

From the OrcaFlexBatch class

There is a class method get_and_check_progress on the OrcaFlexBatch class which can be used to get an existing batch by name and instantiate the GUI for the overview.

from qalx_orcaflex.core import OrcaFlexBatch

OrcaFlexBatch.get_and_check_progress("An Example Batch")

GUI Functionality Overview

A summary of the functionality of the batch overview GUI is provided below:

  1. Button to get updates for the state of the jobs on the batch.

  2. Auto-update selection. If set to an interval different that off the updates are automatic according to the selected interval.

  3. Batch revision selection.

  4. Filtering options for the table display. Jobs can be shown/hidden according to the filtering specified

  5. Job management actions. Some simple functionality for the selected jobs of the table is provided.

  6. Job detail table. Shows the details for the jobs of the batch.

  7. Job summary text output. This is a text log of the summary output which is populated every time the job status is updated.

Batch Name and Revision

The name of the batch is shown in the GUI and there is the option to select a different batch revision. Since there can be more that one batches with the same name, the batches are sorted by the creation date and this can be thought of as an implicit revision system.

Job Details and Summary Output

There are two main tabs that show information on the batch job status, each with a different level of detail

Job Details

Job details shows a table with four columns:

  1. The job name

  2. The job state at the time of the last update

  3. The estimated remaining time for the jobs that are in the "Running Dynamics" state

  4. The time stamp of the last update

If a job row is shown in light green, the job is complete.

Job Summary

A text summary is logged every time the update is executed. This contains the summary for all the job states, as well as some descriptive statistics for the remaining time of the jobs that are currently in the "Running Dynamics" state. This should be useful to get an estimate of the remaining time for the whole batch.

Job Details Table Filtering

Some powerful filtering can be applied to the details table which can be very useful in the case of batches with many jobs on them. A combo box can be used to select a specific job state. Additionally, with an AND/OR flag, a second column can be filtered, based on a regular expression. Any valid Python regular expression can be used and the check performed accepts a row if the value of the filtered column at a row returns a match object calling the built-in regex function: re.match(pattern, value), where pattern is the regex typed in the text edit widget. A tooltip shows whether there are any errors in the regex used.

Additionally, clicking on the column title in the table, we can sort according to the values of the column

Download .sim and .dat files

There are two buttons that can be used to download the .sim or the .dat file from selected jobs in the table. A job is considered selected if any of the cells of the job row are selected.

Pressing the Download .dat button, a dialog comes up where the save location can be specified. When more than one jobs are selected, we can only specify the output folder and the file names will be those specified on the files from qalx.

However, if only one job is selected, we can also choose the file name to save as.

Note

Any jobs selected that are not complete are ignored when Download .sim is selected. This is because the .sim file has not been created for these. If all selected jobs are not complete, when an error message will be displayed.

Requeue Jobs

Jobs can also be re-queued with the Requeue Jobs button. This will change the status of the job to "Queued" and mark the job as incomplete. The name of the queue can be specified, and it is set to the original sim queue name of the batch. A different queue name can be selected though, as long as the queue exists, otherwise an error message will be displayed. If any of the selected jobs are in the following states: "Processing", "Running Statics", "Queued", "Loading model data", "Pre-processing" or "Running Dynamics", then a warning will be shown as jobs in these states are not normally expected to be re-queued.