Deploying and Running Workflows¶
The current SDKs have no separate publish or run-now method. create_workflow()/CreateWorkflow() creates the definition and configures its processing rhythm; ProcessMode and data loading determine when jobs appear.
Processing rhythm¶
ProcessMode has two integer fields:
Field |
Meaning |
|---|---|
|
Processing interval in seconds; the SDKs define |
|
Processing offset in seconds |
The high-level document helper always uses interval = -1 and offset = 0. The raw creation examples accept a positive interval such as 3600. Verify the exact scheduling behavior on the target instance because the SDKs have no separate schedule-resource query.
From file load to job¶
A file-triggered flow has five steps:
Create the workflow and retain its ID.
Write a file to the configured source volume and retain the source-file ID.
Query jobs with both identifiers.
Wait for completion or failure.
Read the result from the target volume.
Python:
from moi import RawClient, SDKClient
from moi.models import WorkflowJobStatus
raw = RawClient("https://api.example.com", "your-api-key")
client = SDKClient(raw)
job = client.wait_for_workflow_job(
workflow_id,
source_file_id,
poll_interval=2.0,
timeout=120.0,
wait_for_statuses=[
WorkflowJobStatus.COMPLETED,
WorkflowJobStatus.FAILED,
],
)
print(job["job_id"], WorkflowJobStatus.to_string(job["status"]))
Go:
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
job, err := client.WaitForWorkflowJob(
ctx,
workflowID,
sourceFileID,
2*time.Second,
[]sdk.WorkflowJobStatus{
sdk.WorkflowJobStatusCompleted,
sdk.WorkflowJobStatusFailed,
},
)
if err != nil {
return err
}
fmt.Println(job.JobID, job.Status.String())
The Python helper defaults to a 60-second timeout. The Go helper also applies a 60-second timeout when its context has no deadline. If no target statuses are supplied, both helpers return as soon as a job is found; they do not wait for completion.
Avoid duplicate processing¶
A wait timeout only means the client did not observe the requested state before its deadline. It does not prove that the platform failed to create a job. Do not upload the same source again immediately. Query again by workflow and source-file ID, and use the SDK’s upload deduplication settings when writing to the source volume.
See Inspecting, Pausing, and Canceling Runs for job status and Lineage and Execution Artifacts for reading results.