feat: run dataflows through durable workers
This commit is contained in:
@@ -214,8 +214,10 @@ export type PipelineRun = {
|
||||
pipeline_id: string;
|
||||
revision: number;
|
||||
run_type: string;
|
||||
status: "running" | "succeeded" | "failed" | "cancelled";
|
||||
status: "queued" | "retrying" | "running" | "succeeded" | "failed" | "cancelled";
|
||||
idempotency_key?: string | null;
|
||||
execution_backend: "auto" | "reference" | "duckdb";
|
||||
environment: "development" | "staging" | "production";
|
||||
definition_hash: string;
|
||||
executor_version: string;
|
||||
source_fingerprints: Record<string, unknown>[];
|
||||
@@ -231,14 +233,37 @@ export type PipelineRun = {
|
||||
delivery_ref?: string | null;
|
||||
correlation_id?: string | null;
|
||||
causation_id?: string | null;
|
||||
attempts: number;
|
||||
max_attempts: number;
|
||||
available_at?: string | null;
|
||||
claimed_at?: string | null;
|
||||
lease_expires_at?: string | null;
|
||||
cancellation_requested_at?: string | null;
|
||||
progress_percent: number;
|
||||
progress_phase: string;
|
||||
retention_until?: string | null;
|
||||
purged_at?: string | null;
|
||||
error?: string | null;
|
||||
started_at: string;
|
||||
started_at?: string | null;
|
||||
finished_at?: string | null;
|
||||
created_by?: string | null;
|
||||
created_at: string;
|
||||
replayed: boolean;
|
||||
};
|
||||
|
||||
export type PipelineDeployment = {
|
||||
id: string;
|
||||
pipeline_id: string;
|
||||
revision: number;
|
||||
environment: "development" | "staging" | "production";
|
||||
source_environment: "development" | "staging" | "production";
|
||||
status: string;
|
||||
provenance: Record<string, unknown>;
|
||||
promoted_by?: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
};
|
||||
|
||||
export type DataflowTriggerKind = "once" | "interval" | "event";
|
||||
export type DataflowTrigger = {
|
||||
id: string;
|
||||
@@ -505,6 +530,10 @@ export function runDataflowPipeline(
|
||||
revision: number;
|
||||
idempotency_key: string;
|
||||
row_limit?: number;
|
||||
execution_backend?: "reference" | "duckdb" | "auto";
|
||||
environment?: "development" | "staging" | "production";
|
||||
max_attempts?: number;
|
||||
retention_days?: number;
|
||||
publication?: {
|
||||
target_datasource_ref?: string | null;
|
||||
name?: string | null;
|
||||
@@ -526,3 +555,45 @@ export function runDataflowPipeline(
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function cancelDataflowPipelineRun(
|
||||
settings: ApiSettings,
|
||||
runRef: string
|
||||
): Promise<PipelineRun> {
|
||||
const runId = runRef.replace(/^dataflow-run:/, "");
|
||||
return apiFetch(
|
||||
settings,
|
||||
`/api/v1/dataflow/runs/${encodeURIComponent(runId)}/cancel`,
|
||||
{ method: "POST" }
|
||||
);
|
||||
}
|
||||
|
||||
export async function listDataflowPipelineDeployments(
|
||||
settings: ApiSettings,
|
||||
pipelineId: string
|
||||
): Promise<PipelineDeployment[]> {
|
||||
const response = await apiFetch<{ deployments: PipelineDeployment[] }>(
|
||||
settings,
|
||||
`/api/v1/dataflow/pipelines/${encodeURIComponent(pipelineId)}/deployments`
|
||||
);
|
||||
return response.deployments;
|
||||
}
|
||||
|
||||
export function promoteDataflowPipeline(
|
||||
settings: ApiSettings,
|
||||
pipelineId: string,
|
||||
payload: {
|
||||
revision: number;
|
||||
source_environment: "development" | "staging";
|
||||
target_environment: "staging" | "production";
|
||||
}
|
||||
): Promise<PipelineDeployment> {
|
||||
return apiFetch(
|
||||
settings,
|
||||
`/api/v1/dataflow/pipelines/${encodeURIComponent(pipelineId)}/promotions`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user