Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Aug 7, 2024
2 parents f060f5b + ee9ce8f commit 7f528e5
Show file tree
Hide file tree
Showing 251 changed files with 123,840 additions and 83,137 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- name: "Metadata"
id: metadata
uses: dependabot/fetch-metadata@v2.1.0
uses: dependabot/fetch-metadata@v2.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: "Enable auto-squash"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to use for the release'
description: "Tag to use for the release"
required: true
name: Release
jobs:
Expand Down
5 changes: 4 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ tasks:
- task: generate-sqlc
seed-dev:
cmds:
- sh ./hack/dev/run-go-with-env.sh run github.com/steebchen/prisma-client-go migrate dev --skip-generate
- SEED_DEVELOPMENT=true sh ./hack/dev/run-go-with-env.sh run ./cmd/hatchet-admin seed
start-dev:
deps:
Expand Down Expand Up @@ -150,6 +149,9 @@ tasks:
lint-frontend:
cmds:
- cd frontend/app/ && pnpm run lint:check
format-prisma:
cmds:
- go run github.com/steebchen/prisma-client-go format
kill-query-engines:
cmds:
- ps -A | grep 'prisma-query-engine-darwin-arm64' | grep -v grep | awk '{print $1}' | xargs kill -9 $1
Expand All @@ -175,4 +177,5 @@ tasks:
deps:
- pre-commit-install
cmds:
- task: format-prisma
- pre-commit run --all-files || pre-commit run --all-files
48 changes: 47 additions & 1 deletion api-contracts/dispatcher/dispatcher.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ service Dispatcher {
rpc RefreshTimeout(RefreshTimeoutRequest) returns (RefreshTimeoutResponse) {}

rpc ReleaseSlot(ReleaseSlotRequest) returns (ReleaseSlotResponse) {}

rpc UpsertWorkerLabels(UpsertWorkerLabelsRequest) returns (UpsertWorkerLabelsResponse) {}
}

message WorkerLabels {
// value of the label
optional string strValue = 1;
optional int32 intValue = 2;
}

message WorkerRegisterRequest {
Expand All @@ -45,6 +53,9 @@ message WorkerRegisterRequest {

// (optional) the max number of runs this worker can handle
optional int32 maxRuns = 4;

// (optional) worker labels (i.e. state or other metadata)
map<string, WorkerLabels> labels = 5;
}

message WorkerRegisterResponse {
Expand All @@ -58,6 +69,23 @@ message WorkerRegisterResponse {
string workerName = 3;
}

message UpsertWorkerLabelsRequest {
// the name of the worker
string workerId = 1;

// (optional) the worker labels
map<string, WorkerLabels> labels = 2;
}


message UpsertWorkerLabelsResponse {
// the tenant id
string tenantId = 1;

// the id of the worker
string workerId = 2;
}

enum ActionType {
START_STEP_RUN = 0;
CANCEL_STEP_RUN = 1;
Expand Down Expand Up @@ -103,6 +131,18 @@ message AssignedAction {

// the count number of the retry attempt
int32 retryCount = 13;

// (optional) additional metadata set on the workflow
optional string additional_metadata = 14;

// (optional) the child workflow index (if this is a child workflow)
optional int32 child_workflow_index = 15;

// (optional) the child workflow key (if this is a child workflow)
optional string child_workflow_key = 16;

// (optional) the parent workflow run id (if this is a child workflow)
optional string parent_workflow_run_id = 17;
}

message WorkerListenRequest {
Expand Down Expand Up @@ -196,7 +236,13 @@ message ActionEventResponse {

message SubscribeToWorkflowEventsRequest {
// the id of the workflow run
string workflowRunId = 1;
optional string workflowRunId = 1;

// the key of the additional meta field to subscribe to
optional string additionalMetaKey = 2;

// the value of the additional meta field to subscribe to
optional string additionalMetaValue = 3;
}

message SubscribeToWorkflowRunsRequest {
Expand Down
16 changes: 16 additions & 0 deletions api-contracts/openapi/components/schemas/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,16 @@ Step:
$ref: "./workflow.yaml#/Step"
WorkflowRun:
$ref: "./workflow_run.yaml#/WorkflowRun"
ReplayWorkflowRunsRequest:
$ref: "./workflow_run.yaml#/ReplayWorkflowRunsRequest"
ReplayWorkflowRunsResponse:
$ref: "./workflow_run.yaml#/ReplayWorkflowRunsResponse"
WorkflowRunList:
$ref: "./workflow_run.yaml#/WorkflowRunList"
WorkflowRunOrderByField:
$ref: "./workflow_run.yaml#/WorkflowRunOrderByField"
WorkflowRunOrderByDirection:
$ref: "./workflow_run.yaml#/WorkflowRunOrderByDirection"
WorkflowRunsMetrics:
$ref: "./workflow_run.yaml#/WorkflowRunsMetrics"
WorkflowRunsMetricsCounts:
Expand All @@ -134,6 +142,10 @@ WorkflowRunStatus:
$ref: "./workflow_run.yaml#/WorkflowRunStatus"
WorkflowRunStatusList:
$ref: "./workflow_run.yaml#/WorkflowRunStatusList"
WorkflowKind:
$ref: "./workflow_run.yaml#/WorkflowKind"
WorkflowKindList:
$ref: "./workflow_run.yaml#/WorkflowKindList"
WorkflowRunsCancelRequest:
$ref: "./workflow_run.yaml#/WorkflowRunsCancelRequest"
JobRunStatus:
Expand Down Expand Up @@ -162,6 +174,10 @@ WorkerList:
$ref: "./worker.yaml#/WorkerList"
Worker:
$ref: "./worker.yaml#/Worker"
WorkerLabel:
$ref: "./worker.yaml#/WorkerLabel"
UpdateWorkerRequest:
$ref: "./worker.yaml#/UpdateWorkerRequest"
APIToken:
$ref: "./api_tokens.yaml#/APIToken"
CreateAPITokenRequest:
Expand Down
5 changes: 5 additions & 0 deletions api-contracts/openapi/components/schemas/api_tokens.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ CreateAPITokenRequest:
type: string
description: A name for the API token.
maxLength: 255
expiresIn:
type: string
description: The duration for which the token is valid.
x-oapi-codegen-extra-tags:
validate: "omitnil,duration"
required:
- name

Expand Down
3 changes: 1 addition & 2 deletions api-contracts/openapi/components/schemas/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ APIResourceMeta:
type: string
description: "the id of this resource, in UUID format"
example: bb214807-246e-43a5-a25d-41761d1cff9e
minLength: 36
minLength: 0
maxLength: 36
format: uuid
createdAt:
type: string
description: the time that this resource was created
Expand Down
28 changes: 28 additions & 0 deletions api-contracts/openapi/components/schemas/worker.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
WorkerLabel:
properties:
metadata:
$ref: "./metadata.yaml#/APIResourceMeta"
key:
type: string
description: The key of the label.
value:
type: string
description: The value of the label.
required:
- metadata
- key
type: object

Worker:
properties:
metadata:
Expand Down Expand Up @@ -31,6 +46,7 @@ Worker:
enum:
- ACTIVE
- INACTIVE
- PAUSED
maxRuns:
type: integer
description: The maximum number of runs this worker can execute concurrently.
Expand All @@ -44,11 +60,23 @@ Worker:
minLength: 36
maxLength: 36
format: uuid
labels:
type: array
description: The current label state of the worker.
items:
$ref: "./_index.yaml#/WorkerLabel"
required:
- metadata
- name
type: object

UpdateWorkerRequest:
properties:
isPaused:
type: boolean
description: Whether the worker is paused and cannot accept new runs.
type: object

WorkerList:
properties:
pagination:
Expand Down
53 changes: 52 additions & 1 deletion api-contracts/openapi/components/schemas/workflow_run.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
WorkflowRunOrderByField:
type: string
enum:
- createdAt
- startedAt
- finishedAt
- duration

WorkflowRunOrderByDirection:
type: string
enum:
- ASC
- DESC

ReplayWorkflowRunsRequest:
properties:
workflowRunIds:
type: array
maxLength: 500
items:
type: string
example: bb214807-246e-43a5-a25d-41761d1cff9e
minLength: 36
maxLength: 36
format: uuid
required:
- workflowRunIds

ReplayWorkflowRunsResponse:
properties:
workflowRuns:
type: array
items:
$ref: "#/WorkflowRun"
required:
- workflowRuns

WorkflowRun:
type: object
properties:
Expand Down Expand Up @@ -30,6 +67,9 @@ WorkflowRun:
finishedAt:
type: string
format: date-time
duration:
type: integer
example: 1000
parentId:
type: string
example: bb214807-246e-43a5-a25d-41761d1cff9e
Expand Down Expand Up @@ -113,6 +153,18 @@ WorkflowRunStatus:
- CANCELLED
- QUEUED

WorkflowKind:
type: string
enum:
- FUNCTION
- DURABLE
- DAG

WorkflowKindList:
type: array
items:
$ref: "#/WorkflowKind"

WorkflowRunStatusList:
type: array
items:
Expand Down Expand Up @@ -383,7 +435,6 @@ StepRunArchive:
- order
- createdAt


StepRunArchiveList:
properties:
pagination:
Expand Down
4 changes: 4 additions & 0 deletions api-contracts/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ paths:
$ref: "./paths/step-run/step-run.yaml#/listArchives"
/api/v1/tenants/{tenant}/workflows/runs:
$ref: "./paths/workflow/workflow.yaml#/workflowRuns"
/api/v1/tenants/{tenant}/workflow-runs/replay:
$ref: "./paths/workflow-run/workflow-run.yaml#/replayWorkflowRuns"
/api/v1/tenants/{tenant}/workflows/runs/metrics:
$ref: "./paths/workflow/workflow.yaml#/workflowRunsMetrics"
/api/v1/tenants/{tenant}/workflow-runs/{workflow-run}:
Expand All @@ -146,3 +148,5 @@ paths:
$ref: "./paths/webhook-worker/webhook-worker.yaml#/webhookworkers"
/api/v1/webhook-workers/{webhook}:
$ref: "./paths/webhook-worker/webhook-worker.yaml#/webhookworker"
/api/v1/workflow-runs/{workflow-run}/input:
$ref: "./paths/workflow-run/workflow-run.yaml#/getWorkflowRunInput"
43 changes: 43 additions & 0 deletions api-contracts/openapi/paths/worker/worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,49 @@ withTenant:
- Worker

withWorker:
patch:
x-resources: ["tenant", "worker"]
description: Update a worker
operationId: worker:update
parameters:
- description: The worker id
in: path
name: worker
required: true
schema:
type: string
format: uuid
minLength: 36
maxLength: 36
requestBody:
content:
application/json:
schema:
$ref: "../../components/schemas/_index.yaml#/UpdateWorkerRequest"
description: The worker update
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "../../components/schemas/_index.yaml#/Worker"
description: Successfully updated the worker
"400":
content:
application/json:
schema:
$ref: "../../components/schemas/_index.yaml#/APIErrors"
description: A malformed or bad request
"403":
content:
application/json:
schema:
$ref: "../../components/schemas/_index.yaml#/APIErrors"
description: Forbidden
summary: Update worker
tags:
- Worker
get:
x-resources: ["tenant", "worker"]
description: Get a worker
Expand Down
Loading

0 comments on commit 7f528e5

Please sign in to comment.