From 75b19545022daaa695da73939e92c446432d7772 Mon Sep 17 00:00:00 2001 From: erwinvaneyk Date: Wed, 9 Aug 2017 16:20:16 -0700 Subject: [PATCH 1/3] Convert iinputs to a map[string]string --- Docs/notes.md | 4 + examples/simple/fortunewhale.wf.json | 10 +- pkg/api/function/api.go | 1 - pkg/api/workflow/validator.go | 6 +- pkg/client/fission/api.go | 7 +- pkg/controller/server.go | 2 +- pkg/scheduler/scheduler.go | 22 ++- pkg/scheduler/scheduler.pb.go | 65 ++++---- pkg/scheduler/scheduler.proto | 2 +- pkg/types/types.go | 1 + pkg/types/types.pb.go | 222 +++++++++++++++++---------- pkg/types/types.proto | 17 +- 12 files changed, 220 insertions(+), 139 deletions(-) create mode 100644 Docs/notes.md diff --git a/Docs/notes.md b/Docs/notes.md new file mode 100644 index 00000000..84e3ae15 --- /dev/null +++ b/Docs/notes.md @@ -0,0 +1,4 @@ +# Unstructured Notes + +- A task can only be executed at most once! +- The identifier of a task must be unique within the workflow! diff --git a/examples/simple/fortunewhale.wf.json b/examples/simple/fortunewhale.wf.json index fa08ffe9..0d9e85b6 100644 --- a/examples/simple/fortunewhale.wf.json +++ b/examples/simple/fortunewhale.wf.json @@ -1,8 +1,8 @@ { "version": "v1", - "name" : "whyisthisrequired", + "name": "whyisthisrequired", "src": { - "outputTask" : "makeWhaleSayFortune", + "outputTask": "makeWhaleSayFortune", "tasks": { "generateFortune": { "type": "function", @@ -11,9 +11,9 @@ "makeWhaleSayFortune": { "type": "function", "name": "whalesay", - "dependencies": [ - "generateFortune" - ] + "dependencies": { + "generateFortune" : {} + } } } } diff --git a/pkg/api/function/api.go b/pkg/api/function/api.go index 346b2bdd..a3dcfec4 100644 --- a/pkg/api/function/api.go +++ b/pkg/api/function/api.go @@ -8,7 +8,6 @@ import ( "github.com/fission/fission-workflow/pkg/types" "github.com/fission/fission-workflow/pkg/util" "github.com/golang/protobuf/ptypes" - "github.com/sirupsen/logrus" ) // Responsible for executing functions diff --git a/pkg/api/workflow/validator.go b/pkg/api/workflow/validator.go index dc637228..38ea751f 100644 --- a/pkg/api/workflow/validator.go +++ b/pkg/api/workflow/validator.go @@ -68,9 +68,9 @@ func (vl *Validator) Validate(spec *types.WorkflowSpec) error { startTasks = append(startTasks, task) } - for _, dep := range task.GetDependencies() { - if _, ok := refTable[dep]; !ok { - return fmt.Errorf("Task '%s' ocntains undefined dependency '%s'", taskId, dep) + for depName, _ := range task.GetDependencies() { + if _, ok := refTable[depName]; !ok { + return fmt.Errorf("Task '%s' ocntains undefined dependency '%s'", taskId, depName) } } } diff --git a/pkg/client/fission/api.go b/pkg/client/fission/api.go index a9206bd5..c8b7dad9 100644 --- a/pkg/client/fission/api.go +++ b/pkg/client/fission/api.go @@ -44,7 +44,10 @@ func (fe *FunctionEnv) InvokeSync(spec *types.FunctionInvocationSpec) (*types.Fu url := fmt.Sprintf("http://%s", serviceUrl) - input := strings.NewReader(spec.Input) + // Map input parameters to actual Fission function parameters + + input := strings.NewReader(spec.Input[types.INPUT_MAIN]) + // TODO map other parameters as well (to params) req, err := http.NewRequest("GET", url, input) // TODO allow change of method if err != nil { @@ -66,7 +69,7 @@ func (fe *FunctionEnv) InvokeSync(spec *types.FunctionInvocationSpec) (*types.Fu return &types.FunctionInvocationStatus{ Status: types.FunctionInvocationStatus_SUCCEEDED, - Output: string(body), + Output: body, }, nil } diff --git a/pkg/controller/server.go b/pkg/controller/server.go index d34ad911..9c8d0c09 100644 --- a/pkg/controller/server.go +++ b/pkg/controller/server.go @@ -101,7 +101,7 @@ func (cr *InvocationController) handleNotification(notification *project.Invocat if len(schedule.Actions) == 0 { // TODO controller should verify (it is an invariant) output := invoc.Status.Tasks[wf.Spec.Src.OutputTask].Status.Output - err := cr.invocationApi.Success(invoc.Metadata.Id, output) + err := cr.invocationApi.Success(invoc.Metadata.Id, string(output)) if err != nil { panic(err) } diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index 291b8044..4edcdaff 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -53,8 +53,8 @@ func (ws *WorkflowScheduler) Evaluate(request *ScheduleRequest) (*Schedule, erro horizon := map[string]*types.Task{} for id, task := range openTasks { free := true - for _, dep := range task.GetDependencies() { - if _, ok := openTasks[dep]; ok { + for depName := range task.GetDependencies() { + if _, ok := openTasks[depName]; ok { free = false break } @@ -69,19 +69,25 @@ func (ws *WorkflowScheduler) Evaluate(request *ScheduleRequest) (*Schedule, erro // Determine schedule nodes for taskId, task := range horizon { // Fetch input - var input string + inputs := map[string]string{} if len(task.GetDependencies()) == 0 { - input = request.Invocation.Spec.Input + inputs[types.INPUT_MAIN] = request.Invocation.Spec.Input } else { - for _, dep := range task.GetDependencies() { - // TODO allow input of more than one dependency - input = request.Invocation.Status.Tasks[dep].Status.Output + + for depName, dep := range task.GetDependencies() { + // TODO check for overwrites (especially the alias) + inputs[depName] = string(request.Invocation.Status.Tasks[depName].Status.Output) + if len(dep.Alias) > 0 { + inputs[dep.Alias] = inputs[depName] + } + } + // Decide which one is the main input } invokeTaskAction, _ := ptypes.MarshalAny(&InvokeTaskAction{ Id: taskId, - Input: input, + Input: inputs, }) schedule.Actions = append(schedule.Actions, &Action{ diff --git a/pkg/scheduler/scheduler.pb.go b/pkg/scheduler/scheduler.pb.go index 47b06355..b34e5566 100644 --- a/pkg/scheduler/scheduler.pb.go +++ b/pkg/scheduler/scheduler.pb.go @@ -142,8 +142,8 @@ func (m *AbortAction) GetReason() string { type InvokeTaskAction struct { // Id of the task in the workflow - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Input string `protobuf:"bytes,2,opt,name=input" json:"input,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Input map[string]string `protobuf:"bytes,2,rep,name=input" json:"input,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` } func (m *InvokeTaskAction) Reset() { *m = InvokeTaskAction{} } @@ -158,11 +158,11 @@ func (m *InvokeTaskAction) GetId() string { return "" } -func (m *InvokeTaskAction) GetInput() string { +func (m *InvokeTaskAction) GetInput() map[string]string { if m != nil { return m.Input } - return "" + return nil } type ScheduleRequest struct { @@ -273,31 +273,34 @@ var _Scheduler_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("pkg/scheduler/scheduler.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 416 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0x51, 0x6b, 0xdb, 0x30, - 0x18, 0xac, 0xd3, 0x36, 0x89, 0x3f, 0x8f, 0x36, 0x68, 0x65, 0x64, 0x81, 0xd1, 0xcc, 0x50, 0xc8, - 0x06, 0x93, 0xc1, 0x85, 0xd1, 0x3d, 0x7a, 0xb0, 0x87, 0x50, 0x58, 0x41, 0x35, 0x1b, 0x7b, 0x1a, - 0x8a, 0xad, 0xa4, 0xc2, 0xb6, 0xe4, 0x59, 0x72, 0x8a, 0x7f, 0xc3, 0xfe, 0xf4, 0x88, 0x2d, 0xd9, - 0x5b, 0xf6, 0x62, 0xfb, 0xbb, 0xbb, 0xef, 0xb8, 0xef, 0x0c, 0x6f, 0xca, 0x6c, 0x17, 0xa8, 0xe4, - 0x89, 0xa5, 0x75, 0xce, 0xaa, 0xe1, 0x0b, 0x97, 0x95, 0xd4, 0x72, 0xf1, 0x69, 0xc7, 0xf5, 0x53, - 0xbd, 0xc1, 0x89, 0x2c, 0x82, 0x2d, 0x57, 0x8a, 0x4b, 0x61, 0xdf, 0x1f, 0x9e, 0x65, 0x95, 0x6d, - 0x73, 0xf9, 0x1c, 0x1c, 0x2c, 0x74, 0x53, 0x32, 0xd5, 0x3d, 0xcd, 0xea, 0xf5, 0x4e, 0xca, 0x5d, - 0xce, 0x82, 0x76, 0xda, 0xd4, 0xdb, 0x40, 0xf3, 0x82, 0x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0xfd, - 0x75, 0xed, 0xba, 0x17, 0xba, 0xf8, 0xbb, 0x01, 0x48, 0x4f, 0xa1, 0x5b, 0x80, 0xa1, 0x62, 0xd3, - 0xe9, 0xcb, 0x5e, 0xb8, 0xee, 0x29, 0xf2, 0x97, 0xec, 0xfd, 0x0a, 0x60, 0xe8, 0x04, 0x5d, 0x82, - 0xb7, 0xfe, 0xfa, 0xed, 0xe1, 0xfe, 0xcb, 0xcf, 0x38, 0x7a, 0xbc, 0x9f, 0x9d, 0x20, 0x17, 0xce, - 0xa3, 0xcf, 0x0f, 0x24, 0x9e, 0x39, 0xe1, 0x47, 0x70, 0x6d, 0xb0, 0x0a, 0xbd, 0x83, 0x29, 0xdb, - 0xd3, 0xbc, 0xa6, 0x9a, 0xa1, 0x19, 0x3e, 0x0a, 0xbc, 0x70, 0x7b, 0xc4, 0x3f, 0xd9, 0x8c, 0xdb, - 0x22, 0x6f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x69, 0x6f, 0x1f, 0xb9, 0x02, 0x00, 0x00, + // 459 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x52, 0x5d, 0x8b, 0xd3, 0x40, + 0x14, 0xdd, 0xb4, 0xdb, 0x8f, 0xdc, 0xc8, 0x6e, 0x18, 0x17, 0xa9, 0x45, 0xd9, 0x1a, 0x58, 0xa8, + 0x82, 0x13, 0xc8, 0x82, 0x54, 0xdf, 0x22, 0xec, 0x43, 0x58, 0x70, 0x61, 0x36, 0x28, 0x3e, 0xc9, + 0x34, 0x99, 0x76, 0x43, 0xd2, 0x4c, 0xcc, 0x4c, 0x5a, 0xf2, 0x1b, 0x7c, 0xf1, 0x27, 0x4b, 0x92, + 0x99, 0x46, 0xeb, 0x4b, 0x32, 0xf7, 0x9c, 0x33, 0x87, 0x73, 0xef, 0x1d, 0x78, 0x5d, 0xa4, 0x5b, + 0x57, 0x44,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ff, 0x04, 0x00, + 0x00, 0xff, 0xff, 0x62, 0xfe, 0x60, 0xdd, 0x12, 0x03, 0x00, 0x00, } diff --git a/pkg/scheduler/scheduler.proto b/pkg/scheduler/scheduler.proto index 45e9099f..dd8bb802 100644 --- a/pkg/scheduler/scheduler.proto +++ b/pkg/scheduler/scheduler.proto @@ -42,7 +42,7 @@ message AbortAction { message InvokeTaskAction { // Id of the task in the workflow string id = 1; - string input = 2; // TODO turn into map? + map input = 2; // TODO Future: add here contstraints, preferences, fission scheduler instructions, communication, routing ect. } diff --git a/pkg/types/types.go b/pkg/types/types.go index 4b5186c7..7033f949 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -4,6 +4,7 @@ package types const ( SUBJECT_INVOCATION = "invocation" SUBJECT_WORKFLOW = "workflows" + INPUT_MAIN = "*" ) // InvocationEvent diff --git a/pkg/types/types.pb.go b/pkg/types/types.pb.go index 2d12627f..f13f38ca 100644 --- a/pkg/types/types.pb.go +++ b/pkg/types/types.pb.go @@ -19,6 +19,7 @@ It has these top-level messages: WorkflowInvocation WorkflowDefinition Task + TaskDependencyParameters TaskParameters WorkflowStatus TaskTypeDef @@ -208,6 +209,29 @@ func (WorkflowInvocationStatus_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } +type TaskDependencyParameters_DependencyType int32 + +const ( + TaskDependencyParameters_DATA TaskDependencyParameters_DependencyType = 0 + TaskDependencyParameters_CONTROL TaskDependencyParameters_DependencyType = 1 +) + +var TaskDependencyParameters_DependencyType_name = map[int32]string{ + 0: "DATA", + 1: "CONTROL", +} +var TaskDependencyParameters_DependencyType_value = map[string]int32{ + "DATA": 0, + "CONTROL": 1, +} + +func (x TaskDependencyParameters_DependencyType) String() string { + return proto.EnumName(TaskDependencyParameters_DependencyType_name, int32(x)) +} +func (TaskDependencyParameters_DependencyType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{11, 0} +} + type WorkflowStatus_Status int32 const ( @@ -236,7 +260,7 @@ var WorkflowStatus_Status_value = map[string]int32{ func (x WorkflowStatus_Status) String() string { return proto.EnumName(WorkflowStatus_Status_name, int32(x)) } -func (WorkflowStatus_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0} } +func (WorkflowStatus_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} } // Common type ObjectMetadata struct { @@ -367,10 +391,10 @@ func (m *FunctionInvocation) GetStatus() *FunctionInvocationStatus { type FunctionInvocationSpec struct { // Id of the function to be invoked (no ambiguatity at this point - FunctionId string `protobuf:"bytes,1,opt,name=functionId" json:"functionId,omitempty"` - FunctionName string `protobuf:"bytes,2,opt,name=functionName" json:"functionName,omitempty"` - TaskId string `protobuf:"bytes,3,opt,name=taskId" json:"taskId,omitempty"` - Input string `protobuf:"bytes,4,opt,name=input" json:"input,omitempty"` + FunctionId string `protobuf:"bytes,1,opt,name=functionId" json:"functionId,omitempty"` + FunctionName string `protobuf:"bytes,2,opt,name=functionName" json:"functionName,omitempty"` + TaskId string `protobuf:"bytes,3,opt,name=taskId" json:"taskId,omitempty"` + Input map[string]string `protobuf:"bytes,4,rep,name=input" json:"input,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` } func (m *FunctionInvocationSpec) Reset() { *m = FunctionInvocationSpec{} } @@ -399,17 +423,17 @@ func (m *FunctionInvocationSpec) GetTaskId() string { return "" } -func (m *FunctionInvocationSpec) GetInput() string { +func (m *FunctionInvocationSpec) GetInput() map[string]string { if m != nil { return m.Input } - return "" + return nil } type FunctionInvocationStatus struct { Status FunctionInvocationStatus_Status `protobuf:"varint,1,opt,name=status,enum=FunctionInvocationStatus_Status" json:"status,omitempty"` UpdatedAt *google_protobuf.Timestamp `protobuf:"bytes,2,opt,name=updatedAt" json:"updatedAt,omitempty"` - Output string `protobuf:"bytes,3,opt,name=output" json:"output,omitempty"` + Output []byte `protobuf:"bytes,3,opt,name=output,proto3" json:"output,omitempty"` } func (m *FunctionInvocationStatus) Reset() { *m = FunctionInvocationStatus{} } @@ -431,11 +455,11 @@ func (m *FunctionInvocationStatus) GetUpdatedAt() *google_protobuf.Timestamp { return nil } -func (m *FunctionInvocationStatus) GetOutput() string { +func (m *FunctionInvocationStatus) GetOutput() []byte { if m != nil { return m.Output } - return "" + return nil } // Workflow Invocation Model @@ -594,9 +618,8 @@ type Task struct { // Name/identifier of the function Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` Args []*TaskParameters `protobuf:"bytes,4,rep,name=args" json:"args,omitempty"` - // TODO next or after // Dependencies for this task to execute - Dependencies []string `protobuf:"bytes,5,rep,name=dependencies" json:"dependencies,omitempty"` + Dependencies map[string]*TaskDependencyParameters `protobuf:"bytes,5,rep,name=dependencies" json:"dependencies,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` } func (m *Task) Reset() { *m = Task{} } @@ -625,20 +648,44 @@ func (m *Task) GetArgs() []*TaskParameters { return nil } -func (m *Task) GetDependencies() []string { +func (m *Task) GetDependencies() map[string]*TaskDependencyParameters { if m != nil { return m.Dependencies } return nil } +type TaskDependencyParameters struct { + Type TaskDependencyParameters_DependencyType `protobuf:"varint,1,opt,name=type,enum=TaskDependencyParameters_DependencyType" json:"type,omitempty"` + Alias string `protobuf:"bytes,2,opt,name=alias" json:"alias,omitempty"` +} + +func (m *TaskDependencyParameters) Reset() { *m = TaskDependencyParameters{} } +func (m *TaskDependencyParameters) String() string { return proto.CompactTextString(m) } +func (*TaskDependencyParameters) ProtoMessage() {} +func (*TaskDependencyParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *TaskDependencyParameters) GetType() TaskDependencyParameters_DependencyType { + if m != nil { + return m.Type + } + return TaskDependencyParameters_DATA +} + +func (m *TaskDependencyParameters) GetAlias() string { + if m != nil { + return m.Alias + } + return "" +} + type TaskParameters struct { } func (m *TaskParameters) Reset() { *m = TaskParameters{} } func (m *TaskParameters) String() string { return proto.CompactTextString(m) } func (*TaskParameters) ProtoMessage() {} -func (*TaskParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +func (*TaskParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } // Internal type WorkflowStatus struct { @@ -650,7 +697,7 @@ type WorkflowStatus struct { func (m *WorkflowStatus) Reset() { *m = WorkflowStatus{} } func (m *WorkflowStatus) String() string { return proto.CompactTextString(m) } func (*WorkflowStatus) ProtoMessage() {} -func (*WorkflowStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (*WorkflowStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *WorkflowStatus) GetStatus() WorkflowStatus_Status { if m != nil { @@ -681,7 +728,7 @@ type TaskTypeDef struct { func (m *TaskTypeDef) Reset() { *m = TaskTypeDef{} } func (m *TaskTypeDef) String() string { return proto.CompactTextString(m) } func (*TaskTypeDef) ProtoMessage() {} -func (*TaskTypeDef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (*TaskTypeDef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *TaskTypeDef) GetSrc() string { if m != nil { @@ -709,6 +756,7 @@ func init() { proto.RegisterType((*WorkflowInvocation)(nil), "WorkflowInvocation") proto.RegisterType((*WorkflowDefinition)(nil), "WorkflowDefinition") proto.RegisterType((*Task)(nil), "Task") + proto.RegisterType((*TaskDependencyParameters)(nil), "TaskDependencyParameters") proto.RegisterType((*TaskParameters)(nil), "TaskParameters") proto.RegisterType((*WorkflowStatus)(nil), "WorkflowStatus") proto.RegisterType((*TaskTypeDef)(nil), "TaskTypeDef") @@ -717,77 +765,85 @@ func init() { proto.RegisterEnum("TaskType", TaskType_name, TaskType_value) proto.RegisterEnum("FunctionInvocationStatus_Status", FunctionInvocationStatus_Status_name, FunctionInvocationStatus_Status_value) proto.RegisterEnum("WorkflowInvocationStatus_Status", WorkflowInvocationStatus_Status_name, WorkflowInvocationStatus_Status_value) + proto.RegisterEnum("TaskDependencyParameters_DependencyType", TaskDependencyParameters_DependencyType_name, TaskDependencyParameters_DependencyType_value) proto.RegisterEnum("WorkflowStatus_Status", WorkflowStatus_Status_name, WorkflowStatus_Status_value) } func init() { proto.RegisterFile("pkg/types/types.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1045 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xdd, 0x4e, 0xe3, 0x46, - 0x14, 0xc6, 0x76, 0x12, 0x92, 0x13, 0x48, 0xac, 0x81, 0x06, 0x37, 0x2b, 0x51, 0xea, 0xb6, 0x2a, - 0x65, 0xa5, 0xa0, 0xd2, 0x5e, 0xa0, 0xed, 0x45, 0xe5, 0x8d, 0x07, 0x88, 0x00, 0x27, 0x1d, 0x3b, - 0x8b, 0x5a, 0xa9, 0x42, 0xc6, 0x19, 0x90, 0x17, 0xb0, 0x2d, 0xdb, 0x01, 0x71, 0xbd, 0x77, 0xbd, - 0xaa, 0xfa, 0x06, 0x7d, 0x9e, 0xbe, 0x42, 0x1f, 0xa2, 0x8f, 0x50, 0xcd, 0xf8, 0x27, 0x36, 0x49, - 0xb4, 0xaa, 0xba, 0x7b, 0x63, 0x79, 0xce, 0xf9, 0xe6, 0xfc, 0x7d, 0xe7, 0x9c, 0x81, 0x4f, 0x82, - 0xdb, 0x9b, 0xfd, 0xf8, 0x29, 0xa0, 0x51, 0xf2, 0xed, 0x05, 0xa1, 0x1f, 0xfb, 0xdd, 0xcf, 0x6e, - 0x7c, 0xff, 0xe6, 0x8e, 0xee, 0xf3, 0xd3, 0xd5, 0xf4, 0x7a, 0x3f, 0x76, 0xef, 0x69, 0x14, 0xdb, - 0xf7, 0x41, 0x02, 0x50, 0x7f, 0x81, 0xd6, 0xf0, 0xea, 0x2d, 0x75, 0xe2, 0x73, 0x1a, 0xdb, 0x13, - 0x3b, 0xb6, 0x51, 0x0b, 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 0x16, 0x8b, 0x45, 0xfe, 0x5d, 0x02, 0x65, 0x81, 0xc1, 0x65, 0x45, 0x5e, 0x06, 0xfd, - 0x70, 0x45, 0x7e, 0x05, 0x55, 0xd6, 0x15, 0xac, 0x69, 0xa5, 0xdd, 0xe6, 0xc1, 0x97, 0xcb, 0x5d, - 0x5a, 0x0c, 0x86, 0xbd, 0x38, 0x7c, 0x22, 0xc9, 0x95, 0x02, 0x41, 0x95, 0x22, 0x41, 0xdd, 0x73, - 0x80, 0x19, 0x18, 0xc9, 0x20, 0xdd, 0xd2, 0xa7, 0xb4, 0x42, 0xec, 0x17, 0x7d, 0x03, 0xd5, 0x07, - 0xfb, 0x6e, 0x4a, 0xd3, 0x48, 0x37, 0x16, 0xf4, 0x12, 0x49, 0x10, 0xaf, 0xc4, 0x43, 0x41, 0xfd, - 0xf5, 0xa3, 0xf2, 0xcd, 0x17, 0xc5, 0x7c, 0xd2, 0xff, 0x6f, 0x51, 0x2c, 0xee, 0x99, 0xa5, 0x8b, - 0x62, 0x59, 0xcd, 0xf3, 0x45, 0xf1, 0x57, 0x21, 0xc6, 0xd9, 0xa2, 0x63, 0x3d, 0x68, 0x07, 0xee, - 0x9b, 0x74, 0x4f, 0xa6, 0x3d, 0x38, 0x93, 0xa0, 0xef, 0x33, 0x72, 0x45, 0x4e, 0xee, 0xf6, 0x82, - 0x65, 0xb9, 0x80, 0xd6, 0x6d, 0x80, 0x84, 0x48, 0xa6, 0x4a, 0x67, 0xaf, 0x20, 0xe9, 0xfe, 0xf8, - 0x1e, 0x7a, 0x5f, 0x94, 0xe9, 0xad, 0x72, 0x17, 0x45, 0x42, 0x1f, 0xa1, 0xc2, 0x44, 0x6c, 0xef, - 0xb3, 0x97, 0x31, 0x9d, 0x10, 0xfe, 0x9f, 0xbf, 0x05, 0x52, 0xe1, 0x2d, 0xf8, 0x02, 0x2a, 0x76, - 0x78, 0x13, 0x29, 0x15, 0x9e, 0x45, 0x9b, 0xdb, 0x1b, 0xd9, 0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, 0x2c, 0x68, 0xac, 0xcb, 0x62, 0x09, 0x9a, 0x45, 0x29, 0xa1, 0x17, 0xb0, 0x55, 0x82, - 0x0e, 0x8c, 0xe3, 0xcb, 0x6c, 0x57, 0xec, 0xfd, 0x23, 0x40, 0x7b, 0x36, 0x97, 0x49, 0x1c, 0x32, - 0xac, 0x59, 0x9a, 0x79, 0x7a, 0x69, 0x5a, 0x1a, 0x49, 0x62, 0xc8, 0x25, 0xe9, 0xcb, 0x21, 0xa0, - 0x2e, 0x74, 0xb8, 0xe4, 0x04, 0x6b, 0xc4, 0x7a, 0x8d, 0x35, 0xeb, 0x92, 0xe0, 0x9f, 0xc6, 0xd8, - 0xb4, 0x64, 0x91, 0x39, 0x9c, 0xd3, 0x99, 0xa3, 0xa1, 0x61, 0x62, 0x59, 0x42, 0x08, 0x5a, 0x89, - 0xa9, 0x7c, 0x79, 0x55, 0xd8, 0x72, 0xe3, 0xb2, 0x34, 0xaa, 0x6a, 0xee, 0x2f, 0x5b, 0x63, 0x35, - 0xd4, 0x01, 0x34, 0x30, 0xde, 0x0c, 0xfb, 0x9a, 0x35, 0x18, 0x1a, 0x79, 0x75, 0x56, 0x91, 0x02, - 0x9b, 0x45, 0xf9, 0xf0, 0x7c, 0x94, 0xa4, 0x5d, 0x47, 0x5b, 0xb0, 0x51, 0xd4, 0x68, 0x46, 0x1f, - 0x33, 0xe3, 0x8d, 0x3d, 0x05, 0xea, 0x19, 0x6b, 0x68, 0x0d, 0xea, 0x47, 0x63, 0xa3, 0xcf, 0x20, - 0xf2, 0xca, 0x55, 0x8d, 0x37, 0xf4, 0x77, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x65, 0x92, 0x76, - 0x08, 0xdc, 0x0a, 0x00, 0x00, + // 1163 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xdb, 0x46, + 0x17, 0x35, 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x9a, 0x7e, 0xaa, 0x53, 0xad, 0x29, 0xcb, 0x2f, 0xa1, 0x91, 0xcb, + 0x40, 0x0b, 0xa2, 0x7f, 0x94, 0x78, 0x41, 0x51, 0x38, 0x46, 0x3d, 0xa8, 0xa5, 0x9d, 0xf0, 0x99, + 0x66, 0xe7, 0xdd, 0xf7, 0x02, 0x6c, 0xa4, 0x4c, 0xe8, 0xf7, 0xc4, 0x8b, 0xd1, 0x26, 0x48, 0xe7, + 0x26, 0x3e, 0x39, 0x3c, 0x35, 0xcf, 0x2f, 0xfa, 0x58, 0x57, 0x69, 0x92, 0xb5, 0x82, 0x75, 0x34, + 0xd4, 0x98, 0x55, 0x40, 0x8f, 0xa0, 0x9d, 0x59, 0x69, 0xd1, 0xba, 0x26, 0x89, 0x05, 0x68, 0x5a, + 0x65, 0x09, 0x3d, 0x81, 0xad, 0x02, 0x74, 0x60, 0x1c, 0x5d, 0xa4, 0xda, 0xb9, 0xfb, 0x97, 0x00, + 0xed, 0xb9, 0x4e, 0x25, 0x75, 0x48, 0xd0, 0xb4, 0x55, 0xeb, 0xe4, 0xc2, 0xb2, 0x55, 0x9c, 0xd4, + 0x90, 0x59, 0xf8, 0x97, 0x54, 0x40, 0x3d, 0xe8, 0x30, 0xcb, 0xb1, 0xae, 0x62, 0xfb, 0x95, 0xae, + 0xda, 0x17, 0x58, 0xff, 0x7e, 0xa4, 0x5b, 0xb6, 0x24, 0xd2, 0x84, 0x0b, 0x3e, 0x6b, 0x68, 0x1a, + 0x96, 0x2e, 0x95, 0x10, 0x82, 0x56, 0x12, 0x2a, 0x13, 0xf3, 0x32, 0x15, 0x7b, 0x66, 0xe3, 0x55, + 0x55, 0xb2, 0x7c, 0xa9, 0xac, 0x57, 0x51, 0x07, 0xd0, 0xc0, 0x78, 0x6d, 0xf6, 0x55, 0x7b, 0x60, + 0x1a, 0x19, 0x3b, 0xeb, 0xa8, 0x0b, 0x9b, 0x79, 0xbb, 0x79, 0x36, 0x4c, 0xda, 0xae, 0xa1, 0x2d, + 0x78, 0x94, 0xf7, 0xa8, 0x46, 0x5f, 0xa7, 0xc1, 0xeb, 0xbb, 0x5d, 0xa8, 0xa5, 0x53, 0x43, 0x4d, + 0xa8, 0x1d, 0x8e, 0x8c, 0x3e, 0x85, 0x48, 0x6b, 0x97, 0x55, 0xb6, 0xd0, 0x5f, 0xff, 0x1d, 0x00, + 0x00, 0xff, 0xff, 0xb4, 0x83, 0xbc, 0xda, 0x4a, 0x0c, 0x00, 0x00, } diff --git a/pkg/types/types.proto b/pkg/types/types.proto index c0f120fa..b6906021 100644 --- a/pkg/types/types.proto +++ b/pkg/types/types.proto @@ -60,7 +60,7 @@ message FunctionInvocationSpec { string functionId = 1; string functionName = 2; string taskId = 3; // task in workflow - string input = 4; // TODO turn into map? bytes? + map input = 4; } message FunctionInvocationStatus { @@ -75,7 +75,7 @@ message FunctionInvocationStatus { } Status status = 1; google.protobuf.Timestamp updatedAt = 2; - string output = 3; + bytes output = 3; } // Workflow Invocation Model @@ -150,9 +150,18 @@ message Task { repeated TaskParameters args = 4; - // TODO next or after // Dependencies for this task to execute - repeated string dependencies = 5; + map dependencies = 5; +} + +message TaskDependencyParameters { + + enum DependencyType { + DATA = 0; + CONTROL = 1; + } + DependencyType type = 1; + string alias = 2; } message TaskParameters { From eb4929f08a8de77232a490be96e05f4f05c2974f Mon Sep 17 00:00:00 2001 From: erwinvaneyk Date: Wed, 16 Aug 2017 17:06:31 -0700 Subject: [PATCH 2/3] Updated function api - renamed pkg/client to pkg/fnenv to make it more descriptive - flyby: reduce loggin in nats eventstore client --- pkg/api/function/BUILD.bazel | 6 +- pkg/api/function/api.go | 28 +--- pkg/api/{ => function}/function.go | 12 +- pkg/api/workflow/BUILD.bazel | 4 +- pkg/api/workflow/api.go | 6 +- pkg/api/workflow/parser.go | 15 +- pkg/controller/controller.proto | 2 - pkg/controller/server.go | 36 +++- pkg/eventstore/nats/client.go | 5 +- pkg/{client => fnenv}/fission/BUILD.bazel | 4 +- pkg/{client => fnenv}/fission/proxy.go | 7 +- pkg/fnenv/fission/resolver.go | 26 +++ .../api.go => fnenv/fission/runtime.go} | 22 +-- pkg/fnenv/internal/BUILD.bazel | 8 + pkg/fnenv/internal/builtin.go | 25 +++ pkg/fnenv/internal/runtime.go | 68 ++++++++ pkg/fnenv/test/mock.go | 133 +++++++++++++++ pkg/projector/project/invocation/projector.go | 11 +- pkg/scheduler/scheduler.go | 2 +- pkg/types/types.pb.go | 157 +++++++++--------- pkg/types/types.proto | 9 +- 21 files changed, 419 insertions(+), 167 deletions(-) rename pkg/api/{ => function}/function.go (61%) delete mode 100644 pkg/controller/controller.proto rename pkg/{client => fnenv}/fission/BUILD.bazel (86%) rename pkg/{client => fnenv}/fission/proxy.go (90%) create mode 100644 pkg/fnenv/fission/resolver.go rename pkg/{client/fission/api.go => fnenv/fission/runtime.go} (78%) create mode 100644 pkg/fnenv/internal/BUILD.bazel create mode 100644 pkg/fnenv/internal/builtin.go create mode 100644 pkg/fnenv/internal/runtime.go create mode 100644 pkg/fnenv/test/mock.go diff --git a/pkg/api/function/BUILD.bazel b/pkg/api/function/BUILD.bazel index 8ade4cd6..39d4133f 100644 --- a/pkg/api/function/BUILD.bazel +++ b/pkg/api/function/BUILD.bazel @@ -2,10 +2,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", - srcs = ["api.go"], + srcs = [ + "api.go", + "function.go", + ], visibility = ["//visibility:public"], deps = [ - "//pkg/api:go_default_library", "//pkg/eventstore:go_default_library", "//pkg/eventstore/eventids:go_default_library", "//pkg/eventstore/events:go_default_library", diff --git a/pkg/api/function/api.go b/pkg/api/function/api.go index a3dcfec4..a3119093 100644 --- a/pkg/api/function/api.go +++ b/pkg/api/function/api.go @@ -1,7 +1,6 @@ package function import ( - "github.com/fission/fission-workflow/pkg/api" "github.com/fission/fission-workflow/pkg/eventstore" "github.com/fission/fission-workflow/pkg/eventstore/eventids" "github.com/fission/fission-workflow/pkg/eventstore/events" @@ -10,20 +9,20 @@ import ( "github.com/golang/protobuf/ptypes" ) -// Responsible for executing functions +// A function.Runtime wrapper that deals with the higher-level logic workflow-related logic type Api struct { - runtime api.FunctionRuntimeEnv + runtime Runtime // TODO support async esClient eventstore.Client } -func NewFissionFunctionApi(runtime api.FunctionRuntimeEnv, esClient eventstore.Client) *Api { +func NewFissionFunctionApi(runtime Runtime, esClient eventstore.Client) *Api { return &Api{ runtime: runtime, esClient: esClient, } } -func (ap *Api) InvokeSync(invocationId string, fnSpec *types.FunctionInvocationSpec) (*types.FunctionInvocation, error) { +func (ap *Api) Invoke(invocationId string, fnSpec *types.FunctionInvocationSpec) (*types.FunctionInvocation, error) { eventid := eventids.NewSubject(types.SUBJECT_INVOCATION, invocationId) fn := &types.FunctionInvocation{ @@ -46,10 +45,13 @@ func (ap *Api) InvokeSync(invocationId string, fnSpec *types.FunctionInvocationS return nil, err } - fnResult, err := ap.runtime.InvokeSync(fnSpec) // TODO spec or container? + fnResult, err := ap.runtime.Invoke(fnSpec) // TODO spec or container? if err != nil { failedEvent := events.New(eventid, types.InvocationEvent_TASK_FAILED.String(), fnAny) // TODO record error message - err = ap.esClient.Append(failedEvent) + esErr := ap.esClient.Append(failedEvent) + if esErr != nil { + return nil, esErr + } return nil, err } fn.Status = fnResult @@ -67,15 +69,3 @@ func (ap *Api) InvokeSync(invocationId string, fnSpec *types.FunctionInvocationS fn.Status = fnResult return fn, nil } - -func (ap *Api) Invoke(invocationId string, spec *types.FunctionInvocationSpec) (string, error) { - panic("implement me") -} - -func (ap *Api) Cancel(fnInvocationId string) error { - panic("implement me") -} - -func (ap *Api) Status(fnInvocationId string) (*types.FunctionInvocationStatus, error) { - panic("implement me") -} diff --git a/pkg/api/function.go b/pkg/api/function/function.go similarity index 61% rename from pkg/api/function.go rename to pkg/api/function/function.go index a917588b..84f3ad31 100644 --- a/pkg/api/function.go +++ b/pkg/api/function/function.go @@ -1,20 +1,22 @@ -package api +package function import ( "github.com/fission/fission-workflow/pkg/types" ) -type FunctionRuntimeEnv interface { - Invoke(spec *types.FunctionInvocationSpec) (string, error) +type Runtime interface { + Invoke(spec *types.FunctionInvocationSpec) (*types.FunctionInvocationStatus, error) +} - InvokeSync(spec *types.FunctionInvocationSpec) (*types.FunctionInvocationStatus, error) +type AsyncRuntime interface { + InvokeAsync(spec *types.FunctionInvocationSpec) (string, error) Cancel(fnInvocationId string) error Status(fnInvocationId string) (*types.FunctionInvocationStatus, error) } -type FunctionRegistry interface { +type Resolver interface { // Resolve an ambiguous function name to a unique identifier of a function // // If the fnName does not exist an error will be displayed diff --git a/pkg/api/workflow/BUILD.bazel b/pkg/api/workflow/BUILD.bazel index 40cb6f74..3be60743 100644 --- a/pkg/api/workflow/BUILD.bazel +++ b/pkg/api/workflow/BUILD.bazel @@ -9,6 +9,7 @@ go_library( ], visibility = ["//visibility:public"], deps = [ + "//pkg/api/function:go_default_library", "//pkg/cache:go_default_library", "//pkg/eventstore:go_default_library", "//pkg/eventstore/eventids:go_default_library", @@ -17,9 +18,6 @@ go_library( "//pkg/projector/project/workflow:go_default_library", "//pkg/types:go_default_library", "//pkg/util:go_default_library", - "//vendor/github.com/fission/fission:go_default_library", - "//vendor/github.com/fission/fission/controller/client:go_default_library", "//vendor/github.com/golang/protobuf/ptypes:go_default_library", - "//vendor/github.com/sirupsen/logrus:go_default_library", ], ) diff --git a/pkg/api/workflow/api.go b/pkg/api/workflow/api.go index e79f3062..c918c528 100644 --- a/pkg/api/workflow/api.go +++ b/pkg/api/workflow/api.go @@ -1,6 +1,8 @@ package workflow import ( + "fmt" + "github.com/fission/fission-workflow/pkg/cache" "github.com/fission/fission-workflow/pkg/eventstore" "github.com/fission/fission-workflow/pkg/eventstore/eventids" @@ -10,7 +12,6 @@ import ( "github.com/fission/fission-workflow/pkg/types" "github.com/fission/fission-workflow/pkg/util" "github.com/golang/protobuf/ptypes" - "github.com/sirupsen/logrus" ) type Api struct { @@ -44,8 +45,7 @@ func (wa *Api) Create(workflow *types.WorkflowSpec) (string, error) { // TODO more FT parsed, err := wa.Parser.Parse(workflow) if err != nil { - logrus.WithField("id", eventId).Errorf("Failed to parse workflow: %v", err) - return id, nil + return "", fmt.Errorf("Failed to parse workflow: %v", err) } parsedData, err := ptypes.MarshalAny(parsed) diff --git a/pkg/api/workflow/parser.go b/pkg/api/workflow/parser.go index 3421d899..146571f8 100644 --- a/pkg/api/workflow/parser.go +++ b/pkg/api/workflow/parser.go @@ -4,16 +4,15 @@ import ( "fmt" "strings" - "github.com/fission/fission" + "github.com/fission/fission-workflow/pkg/api/function" "github.com/fission/fission-workflow/pkg/types" - "github.com/fission/fission/controller/client" ) type Parser struct { - client *client.Client // TODO abstract away fission + client function.Resolver } -func NewParser(client *client.Client) *Parser { +func NewParser(client function.Resolver) *Parser { return &Parser{client} } @@ -43,15 +42,13 @@ func (ps *Parser) Parse(spec *types.WorkflowSpec) (*types.WorkflowStatus, error) func (ps *Parser) parseTask(task *types.Task) (*types.TaskTypeDef, error) { // TODO Split up for different task types name := task.GetName() - fn, err := ps.client.FunctionGet(&fission.Metadata{ - Name: name, - }) + fnId, err := ps.client.Resolve(name) if err != nil { - return nil, err + return nil, fmt.Errorf("Failed to resolve function '%s' using client '%v', because '%v'.", name, ps.client, err) } return &types.TaskTypeDef{ Src: task.GetName(), - Resolved: fn.Uid, + Resolved: fnId, }, nil } diff --git a/pkg/controller/controller.proto b/pkg/controller/controller.proto deleted file mode 100644 index 596fc55b..00000000 --- a/pkg/controller/controller.proto +++ /dev/null @@ -1,2 +0,0 @@ -syntax = "proto3"; - diff --git a/pkg/controller/server.go b/pkg/controller/server.go index 9c8d0c09..eefa252e 100644 --- a/pkg/controller/server.go +++ b/pkg/controller/server.go @@ -3,6 +3,7 @@ package controller import ( "time" + "context" "github.com/fission/fission-workflow/pkg/api/function" "github.com/fission/fission-workflow/pkg/api/invocation" "github.com/fission/fission-workflow/pkg/projector/project" @@ -40,7 +41,7 @@ func NewController(iproject project.InvocationProjector, wfproject project.Workf } // Blocking control loop -func (cr *InvocationController) Run() { +func (cr *InvocationController) Run(ctx context.Context) error { logrus.Debug("Running controller init...") @@ -53,20 +54,29 @@ func (cr *InvocationController) Run() { } // Invocation Notification lane - go func() { + go func(ctx context.Context) { for { - notification := <-cr.notifyChan - logrus.WithField("notification", notification).Info("Handling invocation notification.") - cr.handleNotification(notification) + select { + case notification := <-cr.notifyChan: + logrus.WithField("notification", notification).Info("Handling invocation notification.") + cr.handleNotification(notification) + case <-ctx.Done(): + logrus.WithField("ctx.err", ctx.Err()).Debug("Notification listener closed.") + return + } } - }() + }(ctx) // Control lane logrus.Debug("Init done. Entering control loop.") ticker := time.NewTicker(TICK_SPEED) for { - <-ticker.C - cr.handleControlLoopTick() + select { + case <-ctx.Done(): + return err + case <-ticker.C: + cr.handleControlLoopTick() + } } } @@ -124,7 +134,15 @@ func (cr *InvocationController) handleNotification(notification *project.Invocat FunctionName: taskDef.Src, Input: invokeAction.Input, } - go cr.functionApi.InvokeSync(notification.Id, fnSpec) + go func() { + _, err := cr.functionApi.Invoke(notification.Id, fnSpec) + if err != nil { + logrus.WithFields(logrus.Fields{ + "id": notification.Id, + "err": err, + }).Errorf("Failed to execute task") + } + }() } } default: diff --git a/pkg/eventstore/nats/client.go b/pkg/eventstore/nats/client.go index 78dda5f3..7639af2b 100644 --- a/pkg/eventstore/nats/client.go +++ b/pkg/eventstore/nats/client.go @@ -81,7 +81,6 @@ func (nc *Client) Subscribe(config *eventstore.SubscriptionConfig) (eventstore.S switch subjectEvent.GetType() { case eventstore.SubjectEvent_CREATED: if _, ok := sub.sources[subjectEvent.GetSubject()]; !ok { - fmt.Printf("Subscribing to.... %v\n", subjectEvent.GetSubject()) stanSub, err := nc.subscribeSingle(&eventstore.SubscriptionConfig{ Subject: subjectEvent.GetSubject(), EventCh: config.EventCh, @@ -124,7 +123,6 @@ func (nc *Client) subscribeSingle(config *eventstore.SubscriptionConfig) (stan.S }).Debug("Subscribed to subject.") return nc.conn.Subscribe(config.Subject, func(msg *stan.Msg) { - fmt.Printf("[%s] %v\n", config.Subject, msg) event, err := unmarshalMsg(msg) if err != nil { logrus.Errorf("Failed to retrieve event from msg '%v'", msg) @@ -221,9 +219,8 @@ func (nc *Client) Append(event *eventstore.Event) error { } logrus.WithFields(logrus.Fields{ "subject": invokeSubject, - "event": event, + "eventType": event.Type, "activitySubject": activitySubject, - "activityEvent": activityEvent, }).Info("PUBLISH event to event store.") return nil diff --git a/pkg/client/fission/BUILD.bazel b/pkg/fnenv/fission/BUILD.bazel similarity index 86% rename from pkg/client/fission/BUILD.bazel rename to pkg/fnenv/fission/BUILD.bazel index ddb6e65b..7d4af7d3 100644 --- a/pkg/client/fission/BUILD.bazel +++ b/pkg/fnenv/fission/BUILD.bazel @@ -3,11 +3,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ - "api.go", "proxy.go", + "registry.go", + "runtime.go", ], visibility = ["//visibility:public"], deps = [ + "//pkg/api/function:go_default_library", "//pkg/apiserver:go_default_library", "//pkg/types:go_default_library", "//vendor/github.com/fission/fission:go_default_library", diff --git a/pkg/client/fission/proxy.go b/pkg/fnenv/fission/proxy.go similarity index 90% rename from pkg/client/fission/proxy.go rename to pkg/fnenv/fission/proxy.go index 82a4d8e7..6bd23d11 100644 --- a/pkg/client/fission/proxy.go +++ b/pkg/fnenv/fission/proxy.go @@ -36,10 +36,15 @@ func (fp *FissionProxyServer) handleRequest(w http.ResponseWriter, r *http.Reque panic(err) } + // Map Inputs to function parameters + inputs := map[string]string{ + types.INPUT_MAIN: string(body), + } + ctx := context.Background() invocation, err := fp.invocationServer.InvokeSync(ctx, &types.WorkflowInvocationSpec{ WorkflowId: id, - Input: string(body), + Inputs: inputs, }) if err != nil { http.Error(w, err.Error(), 500) diff --git a/pkg/fnenv/fission/resolver.go b/pkg/fnenv/fission/resolver.go new file mode 100644 index 00000000..8f275797 --- /dev/null +++ b/pkg/fnenv/fission/resolver.go @@ -0,0 +1,26 @@ +package fission + +import ( + "github.com/fission/fission" + "github.com/fission/fission-workflow/pkg/api/function" + "github.com/fission/fission/controller/client" +) + +type Registry struct { + client *client.Client +} + +func NewRegistry(client *client.Client) function.Resolver { + return &Registry{client} +} + +func (re *Registry) Resolve(fnName string) (string, error) { + fn, err := re.client.FunctionGet(&fission.Metadata{ + Name: fnName, + }) + if err != nil { + return "", err + } + + return fn.Uid, nil +} diff --git a/pkg/client/fission/api.go b/pkg/fnenv/fission/runtime.go similarity index 78% rename from pkg/client/fission/api.go rename to pkg/fnenv/fission/runtime.go index c8b7dad9..b1b57b41 100644 --- a/pkg/client/fission/api.go +++ b/pkg/fnenv/fission/runtime.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/fission/fission" + "github.com/fission/fission-workflow/pkg/api/function" "github.com/fission/fission-workflow/pkg/types" controller "github.com/fission/fission/controller/client" poolmgr "github.com/fission/fission/poolmgr/client" @@ -18,14 +19,14 @@ type FunctionEnv struct { controller *controller.Client } -func NewFunctionEnv(poolmgr *poolmgr.Client, controller *controller.Client) *FunctionEnv { +func NewFunctionEnv(poolmgr *poolmgr.Client, controller *controller.Client) function.Runtime { return &FunctionEnv{ poolmgr: poolmgr, controller: controller, } } -func (fe *FunctionEnv) InvokeSync(spec *types.FunctionInvocationSpec) (*types.FunctionInvocationStatus, error) { +func (fe *FunctionEnv) Invoke(spec *types.FunctionInvocationSpec) (*types.FunctionInvocationStatus, error) { meta := &fission.Metadata{ Name: spec.GetFunctionName(), Uid: spec.GetFunctionId(), @@ -72,20 +73,3 @@ func (fe *FunctionEnv) InvokeSync(spec *types.FunctionInvocationSpec) (*types.Fu Output: body, }, nil } - -// Async -func (fe *FunctionEnv) Invoke(spec *types.FunctionInvocationSpec) (string, error) { - panic("implement me") -} - -func (fe *FunctionEnv) Cancel(fnInvocationId string) error { - panic("implement me") -} - -func (fe *FunctionEnv) Status(fnInvocationId string) (*types.FunctionInvocationStatus, error) { - panic("implement me") -} - -func (fe *FunctionEnv) Resolve(fnName string) (string, error) { - panic("implement me") -} diff --git a/pkg/fnenv/internal/BUILD.bazel b/pkg/fnenv/internal/BUILD.bazel new file mode 100644 index 00000000..2fbf5c32 --- /dev/null +++ b/pkg/fnenv/internal/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["runtime.go"], + visibility = ["//visibility:public"], + deps = ["//pkg/types:go_default_library"], +) diff --git a/pkg/fnenv/internal/builtin.go b/pkg/fnenv/internal/builtin.go new file mode 100644 index 00000000..1181160c --- /dev/null +++ b/pkg/fnenv/internal/builtin.go @@ -0,0 +1,25 @@ +package internal + +import ( + "errors" + + "github.com/fission/fission-workflow/pkg/types" + "github.com/sirupsen/logrus" +) + +// Temporary file containing built-in internal functions +// +// Should be refactored to a extensible system, using go plugins for example. + +type FunctionIf struct {} + +func (fn *FunctionIf) Invoke(spec *types.FunctionInvocationSpec) ([]byte, error) { + return nil, errors.New("Not implemented FunctionIf") +} + +type FunctionNoop struct {} + +func (fn *FunctionNoop) Invoke(spec *types.FunctionInvocationSpec) ([]byte, error) { + logrus.WithField("spec", spec).Debug("Noop") + return nil, nil +} diff --git a/pkg/fnenv/internal/runtime.go b/pkg/fnenv/internal/runtime.go new file mode 100644 index 00000000..8a35fefa --- /dev/null +++ b/pkg/fnenv/internal/runtime.go @@ -0,0 +1,68 @@ +package internal + +import ( + "fmt" + + "github.com/fission/fission-workflow/pkg/types" + "github.com/golang/protobuf/ptypes" + log "github.com/sirupsen/logrus" +) + +// An InternalFunction is a function that will be executed in the same process as the invoker. +type InternalFunction interface { + Invoke(spec *types.FunctionInvocationSpec) ([]byte, error) +} + +// Internal InternalFunction Environment for executing low overhead functions, such as control flow constructs +// +// Currently this is golang only. +type FunctionEnv struct { + fns map[string]InternalFunction // Name -> function +} + +func NewFunctionEnv() *FunctionEnv { + return &FunctionEnv{ + fns: map[string]InternalFunction{ + "if" : InternalFunction(FunctionIf{}), + "noop" : InternalFunction(FunctionNoop{}), + }, + } +} + +func (fe *FunctionEnv) Invoke(spec *types.FunctionInvocationSpec) (*types.FunctionInvocationStatus, error) { + fnId := spec.FunctionId + fn, ok := fe.fns[fnId] + if !ok { + return nil, fmt.Errorf("Could not resolve internal function '%s'.", fnId) + } + + out, err := fn.Invoke(spec) + if err != nil { + log.WithFields(log.Fields{ + "fnId" : fnId, + "err" : err, + }).Error("Internal function failed.") + return &types.FunctionInvocationStatus{ + UpdatedAt: ptypes.TimestampNow(), + Status: types.FunctionInvocationStatus_FAILED, + }, nil + } + + return &types.FunctionInvocationStatus{ + UpdatedAt: ptypes.TimestampNow(), + Status: types.FunctionInvocationStatus_SUCCEEDED, + Output: out, + }, nil +} + +func (fe *FunctionEnv) Resolve(fnName string) (string, error) { + _, ok := fe.fns[fnName] + if !ok { + return "", fmt.Errorf("Could not resolve internal function '%s'.", fnName) + } + return fnName, nil +} + +func (fe *FunctionEnv) RegisterFn(name string, fn InternalFunction) { + fe.fns[name] = fn +} diff --git a/pkg/fnenv/test/mock.go b/pkg/fnenv/test/mock.go new file mode 100644 index 00000000..ffeffe61 --- /dev/null +++ b/pkg/fnenv/test/mock.go @@ -0,0 +1,133 @@ +package test + +import ( + "fmt" + + "github.com/fission/fission-workflow/pkg/types" + "github.com/fission/fission-workflow/pkg/util" + "github.com/golang/protobuf/ptypes" + "github.com/sirupsen/logrus" +) + +type MockFunc func(spec *types.FunctionInvocationSpec) ([]byte, error) + +type MockRuntimeEnv struct { + Functions map[string]MockFunc + Results map[string]*types.FunctionInvocation + ManualExecution bool +} + +// Running invoke will change the state of the function invocation to IN_PROGRESS +func (mk *MockRuntimeEnv) InvokeAsync(spec *types.FunctionInvocationSpec) (string, error) { + fnName := spec.FunctionId + + if _, ok := mk.Functions[fnName]; !ok { + return "", fmt.Errorf("Could not invoke unknown function '%s'", fnName) + } + + invocationId := util.Uid() + mk.Results[invocationId] = &types.FunctionInvocation{ + Metadata: &types.ObjectMetadata{ + Id: invocationId, + CreatedAt: ptypes.TimestampNow(), + }, + Spec: spec, + Status: &types.FunctionInvocationStatus{ + Status: types.FunctionInvocationStatus_IN_PROGRESS, + UpdatedAt: ptypes.TimestampNow(), + }, + } + + if !mk.ManualExecution { + err := mk.MockComplete(invocationId) + if err != nil { + panic(err) + } + } + + return invocationId, nil +} + +// Manually completes an existing invocation +func (mk *MockRuntimeEnv) MockComplete(fnInvocationId string) error { + invocation, ok := mk.Results[fnInvocationId] + if !ok { + return fmt.Errorf("Could not invoke unknown invocation '%s'", fnInvocationId) + } + + fnName := invocation.Spec.FunctionId + fn, ok := mk.Functions[fnName] + if !ok { + return fmt.Errorf("Could not invoke unknown function '%s'", fnName) + } + + result, err := fn(invocation.Spec) + if err != nil { + logrus.Infof("Function '%s' invocation resulted in an error: %v", fnName, err) + mk.Results[fnInvocationId].Status = &types.FunctionInvocationStatus{ + Output: nil, + UpdatedAt: ptypes.TimestampNow(), + Status: types.FunctionInvocationStatus_FAILED, + } + } else { + mk.Results[fnInvocationId].Status = &types.FunctionInvocationStatus{ + Output: result, + UpdatedAt: ptypes.TimestampNow(), + Status: types.FunctionInvocationStatus_SUCCEEDED, + } + } + + return nil +} + +func (mk *MockRuntimeEnv) Invoke(spec *types.FunctionInvocationSpec) (*types.FunctionInvocationStatus, error) { + logrus.Info("Starting invocation...") + invocationId, err := mk.InvokeAsync(spec) + if err != nil { + return nil, err + } + err = mk.MockComplete(invocationId) + if err != nil { + return nil, err + } + + logrus.Infof("...completing function execution '%v'", mk.Results) + return mk.Status(invocationId) +} + +func (mk *MockRuntimeEnv) Cancel(fnInvocationId string) error { + invocation, ok := mk.Results[fnInvocationId] + if !ok { + return fmt.Errorf("Could not invoke unknown invocation '%s'", fnInvocationId) + } + + invocation.Status = &types.FunctionInvocationStatus{ + Output: nil, + UpdatedAt: ptypes.TimestampNow(), + Status: types.FunctionInvocationStatus_ABORTED, + } + + return nil +} + +func (mk *MockRuntimeEnv) Status(fnInvocationId string) (*types.FunctionInvocationStatus, error) { + invocation, ok := mk.Results[fnInvocationId]; + if !ok { + return nil, fmt.Errorf("Could not invoke unknown invocation '%s'", fnInvocationId) + } + + return invocation.Status, nil +} + +type MockFunctionResolver struct { + FnNameIds map[string]string +} + +func (mf *MockFunctionResolver) Resolve(fnName string) (string, error) { + fnId, ok := mf.FnNameIds[fnName] + if !ok { + return "", fmt.Errorf("Could not resolve function '%s' using resolve-map '%v'", fnName, mf.FnNameIds) + } + + return fnId, nil +} diff --git a/pkg/projector/project/invocation/projector.go b/pkg/projector/project/invocation/projector.go index 8ffe7191..e1249cd4 100644 --- a/pkg/projector/project/invocation/projector.go +++ b/pkg/projector/project/invocation/projector.go @@ -3,7 +3,8 @@ package invocation import ( "time" - "fmt" + "strings" + "github.com/fission/fission-workflow/pkg/cache" "github.com/fission/fission-workflow/pkg/eventstore" "github.com/fission/fission-workflow/pkg/projector/project" @@ -11,7 +12,6 @@ import ( "github.com/fission/fission-workflow/pkg/types/invocationevent" "github.com/golang/protobuf/ptypes" "github.com/sirupsen/logrus" - "strings" ) type invocationProjector struct { @@ -106,10 +106,7 @@ func (ip *invocationProjector) Cache() cache.Cache { } func (ip *invocationProjector) Close() error { - // Close channel - for _, ch := range ip.subscribers { - close(ch) - } + // Note: subscribers are responsible for closing their own channels return nil } @@ -159,7 +156,6 @@ func (ip *invocationProjector) applyUpdate(event *eventstore.Event) (*types.Work currentState := ip.getCache(invocationId) if currentState == nil { - fmt.Printf("New state! '%s'\n", invocationId) currentState = Initial() } @@ -168,7 +164,6 @@ func (ip *invocationProjector) applyUpdate(event *eventstore.Event) (*types.Work // TODO improve error handling (e.g. retry / replay) return nil, err } - fmt.Printf("newState: '%v' for event '%v'\n", newState, event) err = ip.cache.Put(invocationId, newState) if err != nil { diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index 4edcdaff..7cb60533 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -71,7 +71,7 @@ func (ws *WorkflowScheduler) Evaluate(request *ScheduleRequest) (*Schedule, erro // Fetch input inputs := map[string]string{} if len(task.GetDependencies()) == 0 { - inputs[types.INPUT_MAIN] = request.Invocation.Spec.Input + inputs = request.Invocation.Spec.Inputs } else { for depName, dep := range task.GetDependencies() { diff --git a/pkg/types/types.pb.go b/pkg/types/types.pb.go index f13f38ca..8a56a4b1 100644 --- a/pkg/types/types.pb.go +++ b/pkg/types/types.pb.go @@ -464,8 +464,8 @@ func (m *FunctionInvocationStatus) GetOutput() []byte { // Workflow Invocation Model type WorkflowInvocationSpec struct { - WorkflowId string `protobuf:"bytes,1,opt,name=workflowId" json:"workflowId,omitempty"` - Input string `protobuf:"bytes,2,opt,name=input" json:"input,omitempty"` + WorkflowId string `protobuf:"bytes,1,opt,name=workflowId" json:"workflowId,omitempty"` + Inputs map[string]string `protobuf:"bytes,3,rep,name=inputs" json:"inputs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` } func (m *WorkflowInvocationSpec) Reset() { *m = WorkflowInvocationSpec{} } @@ -480,11 +480,11 @@ func (m *WorkflowInvocationSpec) GetWorkflowId() string { return "" } -func (m *WorkflowInvocationSpec) GetInput() string { +func (m *WorkflowInvocationSpec) GetInputs() map[string]string { if m != nil { - return m.Input + return m.Inputs } - return "" + return nil } type WorkflowInvocationStatus struct { @@ -772,78 +772,79 @@ func init() { func init() { proto.RegisterFile("pkg/types/types.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1163 bytes of a gzipped FileDescriptorProto + // 1184 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xdb, 0x46, - 0x17, 0x35, 0xa9, 0x1f, 0x4b, 0x57, 0xb2, 0xc4, 0x6f, 0xe2, 0x4f, 0x56, 0x14, 0x20, 0x75, 0xd9, - 0x16, 0x71, 0x1d, 0x80, 0x46, 0xdd, 0x2e, 0x8c, 0xa4, 0x40, 0xc1, 0x88, 0xb4, 0x2d, 0xd8, 0x26, - 0xd5, 0x21, 0x15, 0xa3, 0x01, 0x0a, 0x83, 0x96, 0xc6, 0x06, 0x63, 0x9b, 0x24, 0x48, 0xca, 0x81, - 0xd6, 0x79, 0x81, 0xa2, 0x9b, 0xae, 0xfb, 0x3c, 0x7d, 0x85, 0x3e, 0x40, 0x17, 0x5d, 0xf4, 0x11, - 0x8a, 0x19, 0x0e, 0x29, 0xd2, 0x92, 0x10, 0x14, 0x4d, 0x37, 0x02, 0xe7, 0xde, 0xc3, 0xfb, 0x73, - 0xee, 0x9d, 0x43, 0xc1, 0xff, 0x83, 0x9b, 0xeb, 0xbd, 0x78, 0x16, 0x90, 0x28, 0xf9, 0x55, 0x82, - 0xd0, 0x8f, 0xfd, 0xde, 0x27, 0xd7, 0xbe, 0x7f, 0x7d, 0x4b, 0xf6, 0xd8, 0xe9, 0x72, 0x7a, 0xb5, - 0x17, 0xbb, 0x77, 0x24, 0x8a, 0x9d, 0xbb, 0x20, 0x01, 0xc8, 0x6f, 0xa0, 0x65, 0x5e, 0xbe, 0x25, - 0xe3, 0xf8, 0x8c, 0xc4, 0xce, 0xc4, 0x89, 0x1d, 0xd4, 0x02, 0xd1, 0x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x47, 0x82, 0xe8, 0x57, + 0xf1, 0x7c, 0x37, 0x74, 0x3b, 0x9f, 0x5c, 0xbb, 0xee, 0xf5, 0x2d, 0xd9, 0x65, 0xa7, 0xcb, 0xe9, + 0xd5, 0x6e, 0x38, 0xb9, 0x23, 0x41, 0x68, 0xdf, 0x79, 0x11, 0x40, 0x7e, 0x0d, 0x0d, 0xf3, 0xf2, + 0x0d, 0x19, 0x85, 0x67, 0x24, 0xb4, 0xc7, 0x76, 0x68, 0xa3, 0x06, 0x88, 0x93, 0x71, 0x5b, 0xd8, + 0x12, 0xb6, 0xab, 0x58, 0x9c, 0x8c, 0xd1, 0x3e, 0x54, 0x47, 0x3e, 0xb1, 0x43, 0x32, 0x56, 0xc3, + 0x76, 0x61, 0x4b, 0xd8, 0xae, 0xed, 0x75, 0x94, 0x28, 0xac, 0x12, 0x87, 0x55, 0xac, 0x38, 0x2c, + 0x9e, 0x83, 0xe5, 0x77, 0x02, 0x54, 0xce, 0x5d, 0xff, 0xe6, 0xea, 0xd6, 0x7d, 0x8b, 0x9e, 0x43, + 0xe5, 0x8e, 0xa7, 0x60, 0xc1, 0x6b, 0x7b, 0x4d, 0x25, 0x9b, 0x19, 0x27, 0x00, 0xf4, 0x29, 0x14, + 0x03, 0x8f, 0x8c, 0xda, 0x22, 0x03, 0xae, 0x29, 0x71, 0x94, 0x81, 0x47, 0x46, 0x98, 0xb9, 0xd0, + 0x33, 0x28, 0x07, 0xa1, 0x1d, 0x4e, 0x03, 0x5e, 0x53, 0x73, 0x0e, 0x62, 0x66, 0xcc, 0xdd, 0xf2, + 0x08, 0xea, 0xe9, 0xd7, 0x11, 0x82, 0xa2, 0x63, 0xdf, 0x11, 0xde, 0x21, 0x7b, 0x46, 0x6d, 0x58, + 0xbd, 0x27, 0x7e, 0x30, 0x71, 0x1d, 0x96, 0xb2, 0x8a, 0xe3, 0x23, 0xfa, 0x1c, 0x0a, 0x81, 0x3f, + 0xe2, 0x39, 0x1e, 0x25, 0x39, 0x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xac, 0xb4, 0x68, 0x5d, 0x93, + 0xc4, 0x0c, 0x34, 0xae, 0xb2, 0x80, 0x9e, 0xc0, 0x46, 0x06, 0xda, 0x33, 0x8e, 0x2e, 0x62, 0xed, + 0xdc, 0xf9, 0x5b, 0x80, 0xe6, 0x5c, 0xa7, 0xa2, 0x3a, 0x24, 0xa8, 0x5b, 0xea, 0xe0, 0xe4, 0x62, + 0x60, 0xa9, 0x38, 0xaa, 0x21, 0xb1, 0xf0, 0x8f, 0xb5, 0x80, 0x3a, 0xd0, 0x62, 0x96, 0x63, 0x5d, + 0xc5, 0xd6, 0x4b, 0x5d, 0xb5, 0x2e, 0xb0, 0xfe, 0xfd, 0x50, 0x1f, 0x58, 0x92, 0x48, 0x13, 0x2e, + 0xf8, 0x06, 0x7d, 0xd3, 0x18, 0xe8, 0x52, 0x01, 0x21, 0x68, 0x44, 0xa1, 0x12, 0x31, 0x2f, 0x52, + 0xb1, 0x67, 0x36, 0x5e, 0x55, 0x29, 0xc9, 0x17, 0xcb, 0x7a, 0x19, 0xb5, 0x00, 0xf5, 0x8c, 0x57, + 0x66, 0x57, 0xb5, 0x7a, 0xa6, 0x91, 0x4c, 0x67, 0x15, 0xb5, 0x61, 0x3d, 0x6d, 0x37, 0xcf, 0xfa, + 0x51, 0xdb, 0x15, 0xb4, 0x01, 0x8f, 0xd2, 0x1e, 0xd5, 0xe8, 0xea, 0x34, 0x78, 0x75, 0xa7, 0x0d, + 0x95, 0x98, 0x35, 0x54, 0x87, 0xca, 0xe1, 0xd0, 0xe8, 0x52, 0x88, 0xb4, 0x72, 0x59, 0x66, 0x0b, + 0xfd, 0xd5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x47, 0x78, 0x67, 0xad, 0x0c, 0x00, 0x00, } diff --git a/pkg/types/types.proto b/pkg/types/types.proto index b6906021..fbc24f06 100644 --- a/pkg/types/types.proto +++ b/pkg/types/types.proto @@ -76,12 +76,14 @@ message FunctionInvocationStatus { Status status = 1; google.protobuf.Timestamp updatedAt = 2; bytes output = 3; + bool controlFlow = 4; // Indicate whether the output is a control flow or data (default) } // Workflow Invocation Model message WorkflowInvocationSpec { string workflowId = 1; - string input = 2; + map inputs = 3; + // TODO add tasks } message WorkflowInvocationStatus { @@ -184,8 +186,9 @@ message WorkflowStatus { } message TaskTypeDef { - string src = 1; - string resolved = 2; // Address + string src = 1; // Orginal + string runtime = 2; // Function Runtime + string resolved = 3; // Address (Uid) to the // TODO namespace/origin maybe } From 0240b2dfc0356beccc713aae31dca17ab936833a Mon Sep 17 00:00:00 2001 From: erwinvaneyk Date: Wed, 16 Aug 2017 17:07:06 -0700 Subject: [PATCH 3/3] Added integration test for workflow-engine app --- cmd/workflow-engine/BUILD.bazel | 3 + cmd/workflow-engine/app/BUILD.bazel | 2 - cmd/workflow-engine/app/bootstrap.go | 63 +++-- cmd/workflow-engine/app/bootstrap_test.go | 299 ++++++++++++++++++++++ cmd/workflow-engine/workflow-engine.go | 14 + test/README.md | 1 + 6 files changed, 352 insertions(+), 30 deletions(-) create mode 100644 cmd/workflow-engine/app/bootstrap_test.go create mode 100644 test/README.md diff --git a/cmd/workflow-engine/BUILD.bazel b/cmd/workflow-engine/BUILD.bazel index c01f718d..57bbba0c 100644 --- a/cmd/workflow-engine/BUILD.bazel +++ b/cmd/workflow-engine/BUILD.bazel @@ -6,6 +6,9 @@ go_library( visibility = ["//visibility:private"], deps = [ "//cmd/workflow-engine/app:go_default_library", + "//pkg/client/fission:go_default_library", + "//vendor/github.com/fission/fission/controller/client:go_default_library", + "//vendor/github.com/fission/fission/poolmgr/client:go_default_library", "//vendor/github.com/nats-io/go-nats:go_default_library", "//vendor/github.com/sirupsen/logrus:go_default_library", "//vendor/github.com/urfave/cli:go_default_library", diff --git a/cmd/workflow-engine/app/BUILD.bazel b/cmd/workflow-engine/app/BUILD.bazel index 93f04b74..66f79116 100644 --- a/cmd/workflow-engine/app/BUILD.bazel +++ b/cmd/workflow-engine/app/BUILD.bazel @@ -15,8 +15,6 @@ go_library( "//pkg/eventstore/nats:go_default_library", "//pkg/projector/project/invocation:go_default_library", "//pkg/scheduler:go_default_library", - "//vendor/github.com/fission/fission/controller/client:go_default_library", - "//vendor/github.com/fission/fission/poolmgr/client:go_default_library", "//vendor/github.com/gorilla/handlers:go_default_library", "//vendor/github.com/grpc-ecosystem/grpc-gateway/runtime:go_default_library", "//vendor/github.com/nats-io/go-nats-streaming:go_default_library", diff --git a/cmd/workflow-engine/app/bootstrap.go b/cmd/workflow-engine/app/bootstrap.go index 3da60f9e..efe006be 100644 --- a/cmd/workflow-engine/app/bootstrap.go +++ b/cmd/workflow-engine/app/bootstrap.go @@ -17,8 +17,6 @@ import ( inats "github.com/fission/fission-workflow/pkg/eventstore/nats" ip "github.com/fission/fission-workflow/pkg/projector/project/invocation" "github.com/fission/fission-workflow/pkg/scheduler" - "github.com/fission/fission/controller/client" - poolmgr "github.com/fission/fission/poolmgr/client" "github.com/gorilla/handlers" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/nats-io/go-nats-streaming" @@ -33,7 +31,12 @@ const ( ) type Options struct { - EventStore *EventStoreOptions + FunctionRuntimeEnv function.Runtime + FunctionRegistry function.Resolver + EventStore *EventStoreOptions + FissionProxyAddress string + GrpcApiServerAddress string + HttpApiServerAddress string } type EventStoreOptions struct { @@ -44,13 +47,13 @@ type EventStoreOptions struct { // TODO scratch, should be cleaned up // Blocking -func Run(ctx context.Context, options *Options) error { +func Run(ctx context.Context, opts *Options) error { // (shared) gRPC server - lis, err := net.Listen("tcp", GRPC_ADDRESS) + lis, err := net.Listen("tcp", opts.GrpcApiServerAddress) if err != nil { log.Fatalf("failed to listen: %v", err) } - conn, err := grpc.Dial(GRPC_ADDRESS, grpc.WithInsecure()) + conn, err := grpc.Dial(opts.GrpcApiServerAddress, grpc.WithInsecure()) if err != nil { log.Fatalf("did not connect: %v", err) } @@ -60,19 +63,14 @@ func Run(ctx context.Context, options *Options) error { defer lis.Close() // EventStore - stanConn, err := stan.Connect("fissionMQTrigger", "test-client", stan.NatsURL(options.EventStore.Url)) + stanConn, err := stan.Connect(opts.EventStore.Cluster, "test-client", stan.NatsURL(opts.EventStore.Url)) if err != nil { panic(err) } natsClient := inats.New(inats.NewConn(stanConn)) cache := cache.NewMapCache() - // Fission client - poolmgrClient := poolmgr.MakeClient("http://192.168.99.100:32101") - controllerClient := client.MakeClient("http://192.168.99.100:31313") - fissionApi := fission.NewFunctionEnv(poolmgrClient, controllerClient) - - workflowParser := workflow.NewParser(controllerClient) + workflowParser := workflow.NewParser(opts.FunctionRegistry) workflowValidator := workflow.NewValidator() invocationProjector := ip.NewInvocationProjector(natsClient, cache) err = invocationProjector.Watch("invocation.>") @@ -82,7 +80,7 @@ func Run(ctx context.Context, options *Options) error { // Setup API workflowApi := workflow.NewApi(natsClient, workflowParser) invocationApi := invocation.NewApi(natsClient, invocationProjector) - functionApi := function.NewFissionFunctionApi(fissionApi, natsClient) + functionApi := function.NewFissionFunctionApi(opts.FunctionRuntimeEnv, natsClient) err = workflowApi.Projector.Watch("workflows.>") if err != nil { log.Warnf("Failed to watch for workflows, because '%v'.", err) @@ -99,16 +97,16 @@ func Run(ctx context.Context, options *Options) error { // API Gateway server mux := runtime.NewServeMux() - opts := []grpc.DialOption{grpc.WithInsecure()} - err = apiserver.RegisterWorkflowAPIHandlerFromEndpoint(ctx, mux, GRPC_ADDRESS, opts) + grpcOpts := []grpc.DialOption{grpc.WithInsecure()} + err = apiserver.RegisterWorkflowAPIHandlerFromEndpoint(ctx, mux, opts.GrpcApiServerAddress, grpcOpts) if err != nil { panic(err) } - err = apiserver.RegisterAdminAPIHandlerFromEndpoint(ctx, mux, GRPC_ADDRESS, opts) + err = apiserver.RegisterAdminAPIHandlerFromEndpoint(ctx, mux, opts.GrpcApiServerAddress, grpcOpts) if err != nil { panic(err) } - err = apiserver.RegisterWorkflowInvocationAPIHandlerFromEndpoint(ctx, mux, GRPC_ADDRESS, opts) + err = apiserver.RegisterWorkflowInvocationAPIHandlerFromEndpoint(ctx, mux, opts.GrpcApiServerAddress, grpcOpts) if err != nil { panic(err) } @@ -118,23 +116,32 @@ func Run(ctx context.Context, options *Options) error { fissionProxyServer := fission.NewFissionProxyServer(invocationServer) fissionProxyServer.RegisterServer(proxyMux) - go http.ListenAndServe(FISSION_PROXY_ADDRESS, handlers.LoggingHandler(os.Stdout, proxyMux)) - log.Info("Serving HTTP Fission Proxy at: ", FISSION_PROXY_ADDRESS) + proxySrv := http.Server{Addr: opts.FissionProxyAddress} + proxySrv.Handler = handlers.LoggingHandler(os.Stdout, proxyMux) + go proxySrv.ListenAndServe() + log.Info("Serving HTTP Fission Proxy at: ", opts.FissionProxyAddress) - go http.ListenAndServe(API_GATEWAY_ADDRESS, handlers.LoggingHandler(os.Stdout, mux)) - log.Info("Serving HTTP API gateway at: ", API_GATEWAY_ADDRESS) + apiSrv := http.Server{Addr: opts.HttpApiServerAddress} + apiSrv.Handler = handlers.LoggingHandler(os.Stdout, mux) + go apiSrv.ListenAndServe() + log.Info("Serving HTTP API gateway at: ", opts.HttpApiServerAddress) // Controller s := &scheduler.WorkflowScheduler{} ctr := controller.NewController(invocationProjector, workflowApi.Projector, s, functionApi, invocationApi) defer ctr.Close() - go ctr.Run() + go ctr.Run(ctx) // Serve gRPC server log.Info("Serving gRPC services at: ", lis.Addr()) - if err := grpcServer.Serve(lis); err != nil { - log.Fatalf("failed to serve: %v", err) - } - - return nil + go grpcServer.Serve(lis) + + <-ctx.Done() + shutdownCtx := context.Background() + log.Debug("Shutting down servers...") + grpcServer.GracefulStop() // Close + apiSrv.Shutdown(shutdownCtx) + proxySrv.Shutdown(shutdownCtx) + log.Debug("Servers shutdown successfully.") + return shutdownCtx.Err() } diff --git a/cmd/workflow-engine/app/bootstrap_test.go b/cmd/workflow-engine/app/bootstrap_test.go new file mode 100644 index 00000000..3e046950 --- /dev/null +++ b/cmd/workflow-engine/app/bootstrap_test.go @@ -0,0 +1,299 @@ +package app + +import ( + "context" + "fmt" + "os/exec" + "time" + + "os" + "testing" + + "strings" + + "io" + "net" + + "reflect" + + "github.com/fission/fission-workflow/cmd/workflow-engine/app" + "github.com/fission/fission-workflow/pkg/apiserver" + "github.com/fission/fission-workflow/pkg/fnenv/test" + "github.com/fission/fission-workflow/pkg/types" + "github.com/fission/fission-workflow/test/" + "github.com/golang/protobuf/ptypes/empty" + "github.com/nats-io/go-nats" + "github.com/nats-io/go-nats-streaming" + "github.com/sirupsen/logrus" + "google.golang.org/grpc" +) + +var env *app.Options + +const ( + UID_FUNC_ECHO = "FuncUid1" +) + +var mockFuncResolves = map[string]string{ + "echo": UID_FUNC_ECHO, +} + +var mockFuncs = map[string]test.MockFunc{ + UID_FUNC_ECHO: echo, +} + +func echo(spec *types.FunctionInvocationSpec) ([]byte, error) { + val, ok := spec.Input[types.INPUT_MAIN] + if !ok { + return []byte{}, nil + } + return []byte(val), nil +} + +func TestMain(m *testing.M) { + + ctx, cancelFn := context.WithCancel(context.Background()) + env = setup(ctx) + exitCode := m.Run() + defer os.Exit(exitCode) + // Teardown + cancelFn() + <-time.After(time.Duration(2) * time.Second) // Needed in order to let context cancel propagate +} + +// Tests the submission of a workflow +func TestWorkflowCreate(t *testing.T) { + ctx := context.Background() + conn, _ := grpc.Dial(env.GrpcApiServerAddress, grpc.WithInsecure()) + cl := apiserver.NewWorkflowAPIClient(conn) + + // Test workflow creation + spec := &types.WorkflowSpec{ + Name: "TestWorkflowCreate_WF", + Version: "unknown", + Src: &types.WorkflowDefinition{ + ApiVersion: "v1", + OutputTask: "fakeFinalTask", + Tasks: map[string]*types.Task{ + "fakeFinalTask": { + Type: types.TaskType_FUNCTION.String(), + Name: "echo", + }, + }, + }, + } + wfId, err := cl.Create(ctx, spec) + if err != nil { + t.Fatal(err) + } + if wfId == nil || len(wfId.GetId()) == 0 { + t.Errorf("Invalid ID returned '%v'", wfId) + } + + // Test workflow list + l, err := cl.List(ctx, &empty.Empty{}) + if err != nil { + t.Error(err) + } + if len(l.Workflows) != 1 || l.Workflows[0] != wfId.Id { + t.Errorf("Listed workflows '%v' did not match expected workflow '%s'", l.Workflows, wfId.Id) + } + + // Test workflow get + wf, err := cl.Get(ctx, wfId) + if err != nil { + t.Error(err) + } + + if !reflect.DeepEqual(wf.Spec, spec) { + t.Error("Specs of created and fetched do not match!") + } + + if wf.Status.Status != types.WorkflowStatus_READY { + t.Errorf("Workflow status is not ready, but '%v'", wf.Status.Status) + } +} + +func TestWorkflowInvocation(t *testing.T) { + ctx := context.Background() + conn, _ := grpc.Dial(env.GrpcApiServerAddress, grpc.WithInsecure()) + cl := apiserver.NewWorkflowAPIClient(conn) + wi := apiserver.NewWorkflowInvocationAPIClient(conn) + + // Test workflow creation + wf := "TestWorkflowInvocation_WF" + wfSpec := &types.WorkflowSpec{ + Name: wf, + Version: "unknown", + Src: &types.WorkflowDefinition{ + ApiVersion: "v1", + OutputTask: "fakeFinalTask", + Tasks: map[string]*types.Task{ + "fakeFinalTask": { + Type: types.TaskType_FUNCTION.String(), + Name: "echo", + // TODO dependency input + Dependencies: map[string]*types.TaskDependencyParameters{ + "FirstTask": {}, + }, + }, + "FirstTask": { + Type: types.TaskType_FUNCTION.String(), + // TODO input from workflow + Name: "echo", + }, + }, + }, + } + wfResp, err := cl.Create(ctx, wfSpec) + if err != nil { + t.Fatal(err) + } + if wfResp == nil || len(wfResp.GetId()) == 0 { + t.Errorf("Invalid ID returned '%v'", wfResp) + } + + // Create invocation + expectedOutput := "Hello world!" + wiSpec := &types.WorkflowInvocationSpec{ + WorkflowId: wfResp.Id, + Inputs: map[string]string{ + types.INPUT_MAIN: expectedOutput, + }, + } + wiId, err := wi.Invoke(ctx, wiSpec) + if err != nil { + t.Fatal(err) + } + + // Test invocation list + l, err := wi.List(ctx, &empty.Empty{}) + if err != nil { + t.Error(err) + } + if len(l.Invocations) != 1 || l.Invocations[0] != wiId.Id { + t.Errorf("Listed invocations '%v' did not match expected invocation '%s'", l.Invocations, wiId.Id) + } + + // Test invocation get, give some slack to actually invoke it + var invocation *types.WorkflowInvocation + deadline := time.Now().Add(time.Duration(1) * time.Second) + tick := time.NewTicker(time.Duration(100) * time.Millisecond) + for ti := range tick.C { + invoc, err := wi.Get(ctx, wiId) + if err != nil { + t.Error(err) + } + if invoc.Status.Status.Finished() || ti.After(deadline) { + invocation = invoc + tick.Stop() + break + } + } + + if !reflect.DeepEqual(invocation.Spec, wiSpec) { + t.Error("Specs of created and fetched do not match!") + } + + if !strings.EqualFold(invocation.Status.Output, expectedOutput) { + t.Errorf("Output '%s' does not match expected output '%s'", invocation.Status.Output, expectedOutput) + } + + if !invocation.Status.Status.Successful() { + t.Errorf("Invocation status is not succesfull,s but '%v", invocation.Status.Status) + } +} + +func setup(ctx context.Context) *app.Options { + // TODO Maybe replace with actual Fission deployment + mockFunctionRegistry := &test.MockFunctionResolver{mockFuncResolves} + mockFunctionRuntime := &test.MockRuntimeEnv{Functions: mockFuncs, Results: map[string]*types.FunctionInvocation{}} + + esOpts := setupEventStore(ctx) + opts := &app.Options{ + FunctionRegistry: mockFunctionRegistry, + FunctionRuntimeEnv: mockFunctionRuntime, + EventStore: esOpts, + GrpcApiServerAddress: app.GRPC_ADDRESS, + HttpApiServerAddress: app.API_GATEWAY_ADDRESS, + FissionProxyAddress: app.FISSION_PROXY_ADDRESS, + } + go app.Run(ctx, opts) + + return opts +} + +func setupEventStore(ctx context.Context) *app.EventStoreOptions { + clusterId := fmt.Sprintf("fission-workflow-e2e-%d", time.Now().UnixNano()) + port, err := findFreePort() + if err != nil { + panic(err) + } + address := "0.0.0.0" + flags := strings.Split(fmt.Sprintf("-cid %s -p %d -a %s", clusterId, port, address), " ") + logrus.Info(flags) + cmd := exec.CommandContext(ctx, "nats-streaming-server", flags...) + stdOut, _ := cmd.StdoutPipe() + stdErr, _ := cmd.StderrPipe() + go io.Copy(os.Stdout, stdOut) + go io.Copy(os.Stdout, stdErr) + err = cmd.Start() + if err != nil { + panic(err) + } + esOpts := &app.EventStoreOptions{ + Cluster: clusterId, + Type: "NATS", + Url: fmt.Sprintf("nats://%s:%d", address, port), + } + + logrus.WithField("config", esOpts).Info("Setting up NATS server") + + // wait for a bit to set it up + awaitCtx, _ := context.WithTimeout(ctx, time.Duration(10)*time.Second) + err = waitForNats(awaitCtx, esOpts.Url, esOpts.Cluster) + if err != nil { + logrus.Error(err) + } + logrus.WithField("config", esOpts).Info("NATS Server running") + + return esOpts +} + +// Wait for NATS to come online, ignoring ErrNoServer as it could mean that NATS is still being setup +func waitForNats(ctx context.Context, url string, cluster string) error { + conn, err := stan.Connect(cluster, "setupEventStore-alive-test", stan.NatsURL(url), stan.ConnectWait(time.Duration(10)*time.Second)) + if err == nats.ErrNoServers { + logrus.WithFields(logrus.Fields{ + "cluster": cluster, + "url": url, + }).Warn(err) + select { + case <-time.After(time.Duration(1) * time.Second): + return waitForNats(ctx, url, cluster) + case <-ctx.Done(): + + return ctx.Err() + } + } + if err != nil { + return err + } + defer conn.Close() + return nil +} + +func findFreePort() (int, error) { + addr, err := net.ResolveTCPAddr("tcp", "localhost:0") + if err != nil { + return 0, err + } + + listener, err := net.ListenTCP("tcp", addr) + if err != nil { + return 0, err + } + defer listener.Close() + tcpAddr := listener.Addr().(*net.TCPAddr) + return tcpAddr.Port, nil +} diff --git a/cmd/workflow-engine/workflow-engine.go b/cmd/workflow-engine/workflow-engine.go index c9c348b0..1c580914 100644 --- a/cmd/workflow-engine/workflow-engine.go +++ b/cmd/workflow-engine/workflow-engine.go @@ -5,6 +5,9 @@ import ( "os" "github.com/fission/fission-workflow/cmd/workflow-engine/app" + "github.com/fission/fission-workflow/pkg/client/fission" + "github.com/fission/fission/controller/client" + poolmgr "github.com/fission/fission/poolmgr/client" "github.com/nats-io/go-nats" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -33,6 +36,12 @@ func main() { }, } + // Fission client + poolmgrClient := poolmgr.MakeClient("http://192.168.99.100:32101") + controllerClient := client.MakeClient("http://192.168.99.100:31313") + fissionApi := fission.NewFunctionEnv(poolmgrClient, controllerClient) + fissionRegistry := fission.NewRegistry(controllerClient) + cliApp.Action = func(c *cli.Context) error { options := &app.Options{ EventStore: &app.EventStoreOptions{ @@ -40,6 +49,11 @@ func main() { Type: "nats-streaming", Cluster: c.String("eventstore-cluster"), }, + GrpcApiServerAddress: app.GRPC_ADDRESS, + HttpApiServerAddress: app.API_GATEWAY_ADDRESS, + FissionProxyAddress: app.FISSION_PROXY_ADDRESS, + FunctionRuntimeEnv: fissionApi, + FunctionRegistry: fissionRegistry, } return app.Run(ctx, options) diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..38df24d9 --- /dev/null +++ b/test/README.md @@ -0,0 +1 @@ +The test-folder will be used for e2e tests.