Skip to content

Experimental workflow UI#14067

Draft
kriben wants to merge 9 commits into
devfrom
experimental-workflow-ui
Draft

Experimental workflow UI#14067
kriben wants to merge 9 commits into
devfrom
experimental-workflow-ui

Conversation

@kriben
Copy link
Copy Markdown
Collaborator

@kriben kriben commented May 27, 2026

No description provided.

kriben added 9 commits May 18, 2026 08:18
Discover taskmaestro workflows under ~/.taskmaestro/workflows/ and surface
them as a "Workflows" collection in the project tree alongside Scripts.
Each workflow's task input schema is auto-generated by introspecting the
Pydantic models via a Python helper (rips.taskmaestro_helper) and rendered
as PDM field bindings - scalars for str/int/float/bool, and PdmPtrField
pickers for fields typed as rips.Case / rips.WellPath / rips.View.

The Run button on a RimWorkflow writes input.yaml from current bindings
(rips object references serialized as __resinsight_ref__ maps), spawns
the helper's run subcommand, and streams output to a modeless log dialog.
The helper resolves __resinsight_ref__ markers back to live rips objects
via the running ResInsight's gRPC server before driving taskmaestro.
The introspect helper now detects datetime.date / datetime.datetime
field annotations and emits format=date / date-time on the schema
entry. ResInsight dispatches that to a new RimWorkflowDateBinding
backed by caf::PdmField<QDate>, which auto-renders as a calendar
widget via the framework's PdmUiDateEditor. toYamlValue emits an
ISO-formatted date so Pydantic's date validator on the workflow side
accepts it without further conversion.
The introspect helper now delegates JSON-schema format extraction to
pydantic.TypeAdapter, which uniformly emits format=path,
format=file-path, and format=directory-path for pathlib.Path,
pydantic.FilePath, and pydantic.DirectoryPath respectively. Pydantic
splits Annotated path types into annotation+metadata, so the helper
reassembles them before asking TypeAdapter, otherwise DirectoryPath
would lose its directory marker.

ResInsight dispatches all three formats to a new
RimWorkflowFilePathBinding backed by caf::PdmField<caf::FilePath>.
defineEditorAttribute toggles m_selectDirectory based on whether the
schema's format is "directory-path", swapping the file-open dialog
for a directory chooser.
The previous RimWorkflowNumberBinding stored everything as
caf::PdmField<double> and gated YAML emission on an m_isInteger flag,
which meant integer fields rendered in the same free-form decimal
text editor as floats. Splitting into RimWorkflowFloatBinding
(PdmField<double>) and RimWorkflowIntBinding (PdmField<int>) lets
each use the natively-typed editor — integers now render as a
spinbox. Dispatch in createBinding picks the right subclass from the
schema's type ("integer" or "number") emitted by Pydantic.
The introspect helper now captures the JobConfiguration that taskmaestro
builds from input.yaml and merges its per-task field values into each
schema entry's `default`. ResInsight's existing applySchema() methods
already consume `default` to populate their PdmField values, so e.g.
add_perf_1.start_md = 3000.0 from the bundled example now shows up
pre-filled in the property editor instead of starting at zero.

The Pydantic-side default still flows through whenever input.yaml does
not provide a value, so adding an input file is purely additive.
Date and Path values are normalised through a shared _serialize_default
helper so they round-trip cleanly through JSON.
A discovered workflow is now a read-only template that owns one or more RimWorkflowJob configurations, and the Run button lives on the job. New jobs are created from a "New Job" context-menu entry on the workflow (RicNewWorkflowJobFeature), which clones the first job via XML serialization and resolves PDM references.

Each task's bindings render as a single property editor on the job, grouped per task. RimWorkflowFieldBinding exposes a valueField() hook so the binding's value field surfaces in the parent ordering with the binding name as label and description as tooltip. Task inputs are hidden from the project tree.
The Run action on a job is now exposed as RicRunWorkflowJobFeature in the workflow context menu, replacing the m_runButton field and its fieldChangedByUi handler. The job's property editor is left with just the name and per-task binding groups.
Replace RiuWorkflowRunDialog with a lightweight RiuWorkflowJobRunner QObject that owns the QProcess and forwards each stdout line as RiaLogging::info and stderr line as RiaLogging::warning, prefixed with "[<workflow> / <job>]". The lifecycle messages (Running / Finished / failed) go through the same logger. The runner deletes itself on QProcess::finished.

RimWorkflowJob holds the runner via QPointer (transient, not serialized, safe for the XML-clone path used by New Job). Cancellation moves to RicCancelWorkflowJobFeature in the context menu; RicRunWorkflowJobFeature is disabled while a job is running so Run and Cancel toggle in place.
Promote the helper to a static method on RimWorkflow and remove the
identical copy from RimWorkflowJob.cpp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant