Skip to content

Commit

Permalink
Merge branch 'main' into python-fast-api
Browse files Browse the repository at this point in the history
grutt committed Feb 2, 2024
2 parents 1c88ae9 + 6688368 commit 2df1a09
Showing 195 changed files with 19,119 additions and 1,436 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- uses: actions/cache@v3
with:
2 changes: 1 addition & 1 deletion .github/workflows/publish-python-sdk.yaml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
- name: Run publish.sh script
run: |
cd python-client
cd python-sdk
sh publish.sh
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
45 changes: 45 additions & 0 deletions .github/workflows/typescript-sdk-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: typescript-sdk-publish
on:
workflow_dispatch:

jobs:
run-typescript-sdk-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
run: npm install -g pnpm@8

- uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('typescript-sdk/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
working-directory: typescript-sdk

- name: Build SDK
run: pnpm build
working-directory: typescript-sdk

- name: Publish SDK
run: pnpm publish --access public
working-directory: typescript-sdk
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/typescript-sdk-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: typescript-sdk-tests
on:
push:
pull_request:

jobs:
run-typescript-sdk-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
run: npm install -g pnpm@8

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('typescript-sdk/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
working-directory: typescript-sdk

- name: Jest tests
run: pnpm test
working-directory: typescript-sdk
12 changes: 11 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -65,13 +65,23 @@ tasks:
cmds:
- sh ./hack/proto/proto.sh
generate-proto-python:
dir: ./python-client
dir: ./python-sdk
cmds:
- sh ./generate.sh
generate-sqlc:
cmds:
- npx --yes prisma migrate diff --from-empty --to-schema-datasource prisma/schema.prisma --script > internal/repository/prisma/dbsqlc/schema.sql
- go run github.com/sqlc-dev/sqlc/cmd/[email protected] generate --file internal/repository/prisma/dbsqlc/sqlc.yaml
lint:
cmds:
- task: lint-go
- task: lint-frontend
lint-go:
cmds:
- golangci-lint run ./... --config .golangci.yml
lint-frontend:
cmds:
- cd frontend/app/ && pnpm run lint:check
kill-query-engines:
cmds:
- ps -A | grep 'prisma-query-engine-darwin-arm64' | grep -v grep | awk '{print $1}' | xargs kill -9 $1
61 changes: 49 additions & 12 deletions api-contracts/dispatcher/dispatcher.proto
Original file line number Diff line number Diff line change
@@ -9,7 +9,9 @@ service Dispatcher {

rpc Listen(WorkerListenRequest) returns (stream AssignedAction) {}

rpc SendActionEvent(ActionEvent) returns (ActionEventResponse) {}
rpc SendStepActionEvent(StepActionEvent) returns (ActionEventResponse) {}

rpc SendGroupKeyActionEvent(GroupKeyActionEvent) returns (ActionEventResponse) {}

rpc Unsubscribe(WorkerUnsubscribeRequest) returns (WorkerUnsubscribeResponse) {}
}
@@ -39,35 +41,42 @@ message WorkerRegisterResponse {
enum ActionType {
START_STEP_RUN = 0;
CANCEL_STEP_RUN = 1;
START_GET_GROUP_KEY = 2;
}

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

// the workflow run id (optional)
string workflowRunId = 2;

// the get group key run id (optional)
string getGroupKeyRunId = 3;

// the job id
string jobId = 2;
string jobId = 4;

// the job name
string jobName = 3;
string jobName = 5;

// the job run id
string jobRunId = 4;
string jobRunId = 6;

// the step id
string stepId = 5;
string stepId = 7;

// the step run id
string stepRunId = 6;
string stepRunId = 8;

// the action id
string actionId = 7;
string actionId = 9;

// the action type
ActionType actionType = 8;
ActionType actionType = 10;

// the action payload
string actionPayload = 9;
string actionPayload = 11;
}

message WorkerListenRequest {
@@ -88,14 +97,42 @@ message WorkerUnsubscribeResponse {
string workerId = 2;
}

enum ActionEventType {
enum GroupKeyActionEventType {
GROUP_KEY_EVENT_TYPE_UNKNOWN = 0;
GROUP_KEY_EVENT_TYPE_STARTED = 1;
GROUP_KEY_EVENT_TYPE_COMPLETED = 2;
GROUP_KEY_EVENT_TYPE_FAILED = 3;
}

message GroupKeyActionEvent {
// the id of the worker
string workerId = 1;

// the id of the job
string workflowRunId = 2;

string getGroupKeyRunId = 3;

// the action id
string actionId = 4;

google.protobuf.Timestamp eventTimestamp = 5;

// the step event type
GroupKeyActionEventType eventType = 6;

// the event payload
string eventPayload = 7;
}

enum StepActionEventType {
STEP_EVENT_TYPE_UNKNOWN = 0;
STEP_EVENT_TYPE_STARTED = 1;
STEP_EVENT_TYPE_COMPLETED = 2;
STEP_EVENT_TYPE_FAILED = 3;
}

message ActionEvent {
message StepActionEvent {
// the id of the worker
string workerId = 1;

@@ -117,7 +154,7 @@ message ActionEvent {
google.protobuf.Timestamp eventTimestamp = 7;

// the step event type
ActionEventType eventType = 8;
StepActionEventType eventType = 8;

// the event payload
string eventPayload = 9;
10 changes: 10 additions & 0 deletions api-contracts/openapi/components/schemas/workflow_run.yaml
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ WorkflowRun:
$ref: "./_index.yaml#/WorkflowVersion"
status:
$ref: "#/WorkflowRunStatus"
displayName:
type: string
jobRuns:
type: array
items:
@@ -182,15 +184,23 @@ StepRun:
startedAt:
type: string
format: date-time
startedAtEpoch:
type: integer
finishedAt:
type: string
format: date-time
finishedAtEpoch:
type: integer
timeoutAt:
type: string
format: date-time
timeoutAtEpoch:
type: integer
cancelledAt:
type: string
format: date-time
cancelledAtEpoch:
type: integer
cancelledReason:
type: string
cancelledError:
14 changes: 14 additions & 0 deletions api-contracts/workflows/workflows.proto
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ service WorkflowService {
rpc GetWorkflowByName(GetWorkflowByNameRequest) returns (Workflow);
rpc ListWorkflowsForEvent(ListWorkflowsForEventRequest) returns (ListWorkflowsResponse);
rpc DeleteWorkflow(DeleteWorkflowRequest) returns (Workflow);

}

message PutWorkflowRequest {
@@ -28,6 +29,19 @@ message CreateWorkflowVersionOpts {
repeated string cron_triggers = 5; // (optional) cron triggers for the workflow
repeated google.protobuf.Timestamp scheduled_triggers = 6; // (optional) scheduled triggers for the workflow
repeated CreateWorkflowJobOpts jobs = 7; // (required) the workflow jobs
WorkflowConcurrencyOpts concurrency = 8; // (optional) the workflow concurrency options
}

enum ConcurrencyLimitStrategy {
CANCEL_IN_PROGRESS = 0;
DROP_NEWEST = 1;
QUEUE_NEWEST = 2;
}

message WorkflowConcurrencyOpts {
string action = 1; // (required) the action id for getting the concurrency group
int32 max_runs = 2; // (optional) the maximum number of concurrent workflow runs, default 1
ConcurrencyLimitStrategy limit_strategy = 3; // (optional) the strategy to use when the concurrency limit is reached, default CANCEL_IN_PROGRESS
}

// CreateWorkflowJobOpts represents options to create a workflow job.
Loading

0 comments on commit 2df1a09

Please sign in to comment.