Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: workflow authoring and management support #487

Merged
merged 121 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
4eacdd9
feat: initial workflow
mikeee Dec 17, 2023
3e14ead
test: add activity context test for input
mikeee Dec 17, 2023
0ebcf21
test: add context texts
mikeee Dec 17, 2023
217938b
fix/test: identify anonymous functions and add tests to runtime
mikeee Dec 17, 2023
59c2944
chore: lint and minor fixes
mikeee Dec 17, 2023
6e643ed
chore: improve readability+tests and implement context method
mikeee Dec 17, 2023
54d1862
test: add nil coverage
mikeee Dec 17, 2023
4067a32
feat: workflow implementation wip
mikeee Jan 2, 2024
e2a3b18
chore: add missing actor, configuration and workflow runners for vali…
mikeee Jan 2, 2024
22f42cd
chore: lint
mikeee Jan 2, 2024
c5e5ce7
fix: missing formatting directives
mikeee Jan 2, 2024
3aa8468
feat: implement wf state
mikeee Jan 3, 2024
dd483ad
feat: add workflow management
mikeee Jan 4, 2024
be2fc2c
chore: fix direct proto field references and general lint
mikeee Jan 4, 2024
00262a1
fix: correct states
mikeee Jan 4, 2024
0f692c9
fix: refactor workflow contexts
mikeee Jan 4, 2024
587f095
fix: increase verbosity and move channel
mikeee Jan 4, 2024
908fa64
fix: implement full workflow validation
mikeee Jan 4, 2024
719e19b
fix: add dapr-app-id to example
mikeee Jan 4, 2024
680e4db
fix: set endpoint
mikeee Jan 4, 2024
80c57e4
chore: revert actor mod change
mikeee Jan 5, 2024
73252cd
chore: revert sum addition
mikeee Jan 5, 2024
ee81f50
fix: wrap wf management set authtoken in context
mikeee Jan 5, 2024
511541e
fix: migrate to dapr builtin sdk client
mikeee Jan 9, 2024
04a20fa
fix: correct runtime testing logic and lint
mikeee Jan 9, 2024
e31195c
fix: implement delayed cancellation
mikeee Jan 9, 2024
be9b753
fix(minor): rename getDecorator to getFunctionName
mikeee Jan 12, 2024
b2dd53a
fix: remove alpha workflow
mikeee Jan 12, 2024
bae9806
fix(validation): remove redundant result line
mikeee Jan 12, 2024
4610086
feat: initial wfclient implementation
mikeee Jan 14, 2024
72d5db7
fix: remove redundant closer and fix comparison
mikeee Jan 15, 2024
3c42518
tests: improve unit test coverage
mikeee Jan 15, 2024
505e107
fix: cleanup
mikeee Jan 15, 2024
c436614
fix: wording change
mikeee Jan 19, 2024
eef35d2
fix: wording change
mikeee Jan 19, 2024
dad1b79
chore: bump durabletask-go and deps
mikeee Jan 19, 2024
d7266ad
chore: add copyright
mikeee Jan 22, 2024
f25499f
fix: refactor from runtime to worker and other minor changes
mikeee Jan 22, 2024
54a1a83
fix: update worker tests
mikeee Jan 22, 2024
e864cd6
fix: remove workflow component requirement and return worker error
mikeee Jan 22, 2024
d025c6e
fix: reason field validation removed
mikeee Jan 23, 2024
d439917
fix: remove reason tests
mikeee Jan 23, 2024
fdd8cc9
refactoring
mikeee Jan 23, 2024
b8f650c
fix: inputs
mikeee Jan 23, 2024
fa2343b
tests: add coverage to activity options
mikeee Jan 23, 2024
dfb5904
feat: add worker options
mikeee Jan 25, 2024
c3fef2c
fix: remove unused logger
mikeee Jan 25, 2024
56ddaa1
feat: add client options and testing
mikeee Jan 25, 2024
eb7a6a5
feat: decouple metadata
mikeee Jan 29, 2024
e885efb
chore: remove unused client interface
mikeee Jan 29, 2024
5b665f5
chore: update tests
mikeee Jan 29, 2024
4eca0ee
chore: lint
mikeee Jan 29, 2024
4241c36
test: improve coverage
mikeee Jan 29, 2024
656a2ea
tests: improve unit coverage
mikeee Jan 29, 2024
4986e62
feat: initial workflow
mikeee Dec 17, 2023
a9249be
test: add activity context test for input
mikeee Dec 17, 2023
13f3414
test: add context texts
mikeee Dec 17, 2023
e177490
fix/test: identify anonymous functions and add tests to runtime
mikeee Dec 17, 2023
ae48484
chore: lint and minor fixes
mikeee Dec 17, 2023
42523a8
chore: improve readability+tests and implement context method
mikeee Dec 17, 2023
431149f
test: add nil coverage
mikeee Dec 17, 2023
9597649
feat: workflow implementation wip
mikeee Jan 2, 2024
f8885bc
chore: add missing actor, configuration and workflow runners for vali…
mikeee Jan 2, 2024
9b0494c
chore: lint
mikeee Jan 2, 2024
76c0662
fix: missing formatting directives
mikeee Jan 2, 2024
c4c195f
feat: implement wf state
mikeee Jan 3, 2024
06e5b4f
feat: add workflow management
mikeee Jan 4, 2024
e3e836e
chore: fix direct proto field references and general lint
mikeee Jan 4, 2024
ea387fb
fix: correct states
mikeee Jan 4, 2024
b2bce7b
fix: refactor workflow contexts
mikeee Jan 4, 2024
a18b2f5
fix: increase verbosity and move channel
mikeee Jan 4, 2024
919f119
fix: implement full workflow validation
mikeee Jan 4, 2024
255a331
fix: add dapr-app-id to example
mikeee Jan 4, 2024
41ab9c5
fix: set endpoint
mikeee Jan 4, 2024
9d5cfe6
chore: revert actor mod change
mikeee Jan 5, 2024
bd123d0
chore: revert sum addition
mikeee Jan 5, 2024
565f3f6
fix: wrap wf management set authtoken in context
mikeee Jan 5, 2024
5af41dc
fix: migrate to dapr builtin sdk client
mikeee Jan 9, 2024
83ade4e
fix: correct runtime testing logic and lint
mikeee Jan 9, 2024
dfb432e
fix: implement delayed cancellation
mikeee Jan 9, 2024
11a8398
fix(minor): rename getDecorator to getFunctionName
mikeee Jan 12, 2024
5cc2bd1
fix: remove alpha workflow
mikeee Jan 12, 2024
e3fde0a
fix(validation): remove redundant result line
mikeee Jan 12, 2024
71ebe92
feat: initial wfclient implementation
mikeee Jan 14, 2024
2891375
fix: remove redundant closer and fix comparison
mikeee Jan 15, 2024
fdb8501
tests: improve unit test coverage
mikeee Jan 15, 2024
a4d0baf
fix: cleanup
mikeee Jan 15, 2024
54a7a0e
fix: wording change
mikeee Jan 19, 2024
bf21686
fix: wording change
mikeee Jan 19, 2024
77322c5
chore: bump durabletask-go and deps
mikeee Jan 19, 2024
7442ce1
chore: add copyright
mikeee Jan 22, 2024
ba7e389
fix: refactor from runtime to worker and other minor changes
mikeee Jan 22, 2024
e2f5188
fix: update worker tests
mikeee Jan 22, 2024
1b05376
fix: remove workflow component requirement and return worker error
mikeee Jan 22, 2024
57db479
fix: reason field validation removed
mikeee Jan 23, 2024
734bc48
fix: remove reason tests
mikeee Jan 23, 2024
5ab0906
refactoring
mikeee Jan 23, 2024
b4e4847
fix: inputs
mikeee Jan 23, 2024
d74bdfe
tests: add coverage to activity options
mikeee Jan 23, 2024
e2beacd
feat: add worker options
mikeee Jan 25, 2024
64ab57a
fix: remove unused logger
mikeee Jan 25, 2024
19a6ba7
feat: add client options and testing
mikeee Jan 25, 2024
054b1e3
feat: decouple metadata
mikeee Jan 29, 2024
0bb4342
chore: remove unused client interface
mikeee Jan 29, 2024
8796233
chore: update tests
mikeee Jan 29, 2024
85ff5ea
chore: lint
mikeee Jan 29, 2024
7ef1d8f
test: improve coverage
mikeee Jan 29, 2024
34b8bdc
tests: improve unit coverage
mikeee Jan 29, 2024
ac5f0ff
fix: implement code review suggestions/refactor and gracefully handle…
mikeee Jan 30, 2024
042a842
merge upstream/main - remove auth wrapper on context
mikeee Jan 30, 2024
4b0c0a5
fix: innerfailure handling
mikeee Jan 30, 2024
a6126eb
docs: add docs to public methods and functions
mikeee Jan 30, 2024
99aa6ed
implements correction
mikeee Feb 7, 2024
bac187e
change typecast assertion
mikeee Feb 7, 2024
2b0d4ca
improve clarity of notes
mikeee Feb 7, 2024
9e9fcc9
Merge branch 'main' into mikeee-feat-workflow-authoring
mikeee Feb 7, 2024
20886a8
fix mod issues from rebasing interactively on github
mikeee Feb 7, 2024
901dff0
implement suggestions from review
mikeee Feb 7, 2024
69bfe66
remoove unused definition
mikeee Feb 7, 2024
5b9aca9
Merge branch 'main' into mikeee-feat-workflow-authoring
mikeee Feb 8, 2024
6f5aa89
fix mod
mikeee Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions .github/workflows/validate_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ on:
workflow_dispatch:
inputs:
daprdapr_commit:
description: 'Dapr/Dapr commit to build custom daprd from'
description: "Dapr/Dapr commit to build custom daprd from"
required: false
default: ''
default: ""
daprcli_commit:
description: 'Dapr/CLI commit to build custom dapr CLI from'
description: "Dapr/CLI commit to build custom dapr CLI from"
required: false
default: ''
default: ""
repository_dispatch:
types: [ validate-examples ]
types: [validate-examples]
merge_group:
jobs:
setup:
Expand Down Expand Up @@ -154,7 +154,17 @@ jobs:
strategy:
fail-fast: false
matrix:
examples: [ "actor", "configuration", "grpc-service", "hello-world", "pubsub", "service", "socket" ]
examples:
[
"actor",
"configuration",
"grpc-service",
"hello-world",
"pubsub",
"service",
"socket",
"workflow",
]
steps:
- name: Check out code onto GOPATH
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cover: ## Displays test coverage in the client and service packages
go test -coverprofile=cover-client.out ./client && go tool cover -html=cover-client.out
go test -coverprofile=cover-grpc.out ./service/grpc && go tool cover -html=cover-grpc.out
go test -coverprofile=cover-http.out ./service/http && go tool cover -html=cover-http.out
go test -coverprofile=cover-workflow.out ./workflow && go tool cover -html=cover-workflow.out

.PHONY: lint
lint: check-lint ## Lints the entire project
Expand Down
23 changes: 23 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,31 @@ type Client interface {
// ImplActorClientStub is to impl user defined actor client stub
ImplActorClientStub(actorClientStub actor.Client, opt ...config.Option)

// StartWorkflowBeta1 starts a workflow.
StartWorkflowBeta1(ctx context.Context, req *StartWorkflowRequest) (*StartWorkflowResponse, error)

// GetWorkflowBeta1 gets a workflow.
GetWorkflowBeta1(ctx context.Context, req *GetWorkflowRequest) (*GetWorkflowResponse, error)

// PurgeWorkflowBeta1 purges a workflow.
PurgeWorkflowBeta1(ctx context.Context, req *PurgeWorkflowRequest) error

// TerminateWorkflowBeta1 terminates a workflow.
TerminateWorkflowBeta1(ctx context.Context, req *TerminateWorkflowRequest) error

// PauseWorkflowBeta1 pauses a workflow.
PauseWorkflowBeta1(ctx context.Context, req *PauseWorkflowRequest) error

// ResumeWorkflowBeta1 resumes a workflow.
ResumeWorkflowBeta1(ctx context.Context, req *ResumeWorkflowRequest) error

// RaiseEventWorkflowBeta1 raises an event for a workflow.
RaiseEventWorkflowBeta1(ctx context.Context, req *RaiseEventWorkflowRequest) error

// GrpcClient returns the base grpc client if grpc is used and nil otherwise
GrpcClient() pb.DaprClient

GrpcClientConn() *grpc.ClientConn
}

// NewClient instantiates Dapr client using DAPR_GRPC_PORT environment variable as port.
Expand Down
61 changes: 59 additions & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ import (
)

const (
testBufSize = 1024 * 1024
testSocket = "/tmp/dapr.socket"
testBufSize = 1024 * 1024
testSocket = "/tmp/dapr.socket"
testWorkflowFailureID = "test_failure_id"
)

var testClient Client
Expand Down Expand Up @@ -500,6 +501,62 @@ func (s *testDaprServer) UnsubscribeConfiguration(ctx context.Context, in *pb.Un
return &pb.UnsubscribeConfigurationResponse{Ok: true}, nil
}

func (s *testDaprServer) StartWorkflowBeta1(ctx context.Context, in *pb.StartWorkflowRequest) (*pb.StartWorkflowResponse, error) {
if in.GetInstanceId() == testWorkflowFailureID {
return nil, errors.New("test failure")
}
return &pb.StartWorkflowResponse{
InstanceId: in.GetInstanceId(),
}, nil
}

func (s *testDaprServer) GetWorkflowBeta1(ctx context.Context, in *pb.GetWorkflowRequest) (*pb.GetWorkflowResponse, error) {
if in.GetInstanceId() == testWorkflowFailureID {
return nil, errors.New("test failure")
}
return &pb.GetWorkflowResponse{
InstanceId: in.GetInstanceId(),
WorkflowName: "TestWorkflowName",
RuntimeStatus: "Running",
Properties: make(map[string]string),
}, nil
}

func (s *testDaprServer) PurgeWorkflowBeta1(ctx context.Context, in *pb.PurgeWorkflowRequest) (*emptypb.Empty, error) {
if in.GetInstanceId() == testWorkflowFailureID {
return nil, errors.New("test failure")
}
return &emptypb.Empty{}, nil
}

func (s *testDaprServer) TerminateWorkflowBeta1(ctx context.Context, in *pb.TerminateWorkflowRequest) (*emptypb.Empty, error) {
if in.GetInstanceId() == testWorkflowFailureID {
return nil, errors.New("test failure")
}
return &emptypb.Empty{}, nil
}

func (s *testDaprServer) PauseWorkflowBeta1(ctx context.Context, in *pb.PauseWorkflowRequest) (*emptypb.Empty, error) {
if in.GetInstanceId() == testWorkflowFailureID {
return nil, errors.New("test failure")
}
return &emptypb.Empty{}, nil
}

func (s *testDaprServer) ResumeWorkflowBeta1(ctx context.Context, in *pb.ResumeWorkflowRequest) (*emptypb.Empty, error) {
if in.GetInstanceId() == testWorkflowFailureID {
return nil, errors.New("test failure")
}
return &emptypb.Empty{}, nil
}

func (s *testDaprServer) RaiseEventWorkflowBeta1(ctx context.Context, in *pb.RaiseEventWorkflowRequest) (*emptypb.Empty, error) {
if in.GetInstanceId() == testWorkflowFailureID {
return nil, errors.New("test failure")
}
return &emptypb.Empty{}, nil
}

func TestGrpcClient(t *testing.T) {
protoClient := pb.NewDaprClient(nil)
client := &GRPCClient{protoClient: protoClient}
Expand Down
Loading
Loading