conductor_ruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +142 -0
- data/LICENSE +190 -0
- data/README.md +517 -0
- data/examples/agentic_workflows/llm_chat.rb +106 -0
- data/examples/dynamic_workflow.rb +177 -0
- data/examples/event_handler.rb +94 -0
- data/examples/event_listener_examples.rb +430 -0
- data/examples/helloworld/greetings_worker.rb +24 -0
- data/examples/helloworld/helloworld.rb +99 -0
- data/examples/kitchensink.rb +213 -0
- data/examples/metadata_journey.rb +189 -0
- data/examples/metrics_example.rb +284 -0
- data/examples/new_dsl_demo.rb +141 -0
- data/examples/orkes/http_poll.rb +83 -0
- data/examples/orkes/secrets_example.rb +69 -0
- data/examples/orkes/wait_for_webhook.rb +90 -0
- data/examples/prompt_journey.rb +245 -0
- data/examples/rag_workflow.rb +167 -0
- data/examples/schedule_journey.rb +244 -0
- data/examples/simple_worker.rb +125 -0
- data/examples/simple_workflow.rb +89 -0
- data/examples/task_context_example.rb +257 -0
- data/examples/task_listener_example.rb +192 -0
- data/examples/worker_configuration_example.rb +282 -0
- data/examples/workflow_dsl.rb +316 -0
- data/examples/workflow_ops.rb +305 -0
- data/lib/conductor/client/authorization_client.rb +238 -0
- data/lib/conductor/client/integration_client.rb +108 -0
- data/lib/conductor/client/metadata_client.rb +139 -0
- data/lib/conductor/client/prompt_client.rb +58 -0
- data/lib/conductor/client/scheduler_client.rb +132 -0
- data/lib/conductor/client/schema_client.rb +32 -0
- data/lib/conductor/client/secret_client.rb +48 -0
- data/lib/conductor/client/task_client.rb +168 -0
- data/lib/conductor/client/workflow_client.rb +242 -0
- data/lib/conductor/configuration/authentication_settings.rb +17 -0
- data/lib/conductor/configuration.rb +103 -0
- data/lib/conductor/exceptions.rb +86 -0
- data/lib/conductor/http/api/application_resource_api.rb +107 -0
- data/lib/conductor/http/api/authorization_resource_api.rb +56 -0
- data/lib/conductor/http/api/event_resource_api.rb +133 -0
- data/lib/conductor/http/api/gateway_auth_resource_api.rb +48 -0
- data/lib/conductor/http/api/group_resource_api.rb +76 -0
- data/lib/conductor/http/api/integration_resource_api.rb +145 -0
- data/lib/conductor/http/api/metadata_resource_api.rb +231 -0
- data/lib/conductor/http/api/prompt_resource_api.rb +81 -0
- data/lib/conductor/http/api/role_resource_api.rb +60 -0
- data/lib/conductor/http/api/scheduler_resource_api.rb +211 -0
- data/lib/conductor/http/api/schema_resource_api.rb +82 -0
- data/lib/conductor/http/api/secret_resource_api.rb +134 -0
- data/lib/conductor/http/api/task_resource_api.rb +321 -0
- data/lib/conductor/http/api/token_resource_api.rb +42 -0
- data/lib/conductor/http/api/user_resource_api.rb +59 -0
- data/lib/conductor/http/api/workflow_bulk_resource_api.rb +91 -0
- data/lib/conductor/http/api/workflow_resource_api.rb +451 -0
- data/lib/conductor/http/api_client.rb +437 -0
- data/lib/conductor/http/models/authentication_config.rb +67 -0
- data/lib/conductor/http/models/authorization_request.rb +39 -0
- data/lib/conductor/http/models/base_model.rb +162 -0
- data/lib/conductor/http/models/bulk_response.rb +39 -0
- data/lib/conductor/http/models/conductor_application.rb +39 -0
- data/lib/conductor/http/models/conductor_user.rb +53 -0
- data/lib/conductor/http/models/create_or_update_application_request.rb +24 -0
- data/lib/conductor/http/models/create_or_update_role_request.rb +27 -0
- data/lib/conductor/http/models/event_handler.rb +130 -0
- data/lib/conductor/http/models/generate_token_request.rb +27 -0
- data/lib/conductor/http/models/group.rb +36 -0
- data/lib/conductor/http/models/integration.rb +70 -0
- data/lib/conductor/http/models/integration_api.rb +53 -0
- data/lib/conductor/http/models/integration_api_update.rb +43 -0
- data/lib/conductor/http/models/integration_update.rb +36 -0
- data/lib/conductor/http/models/permission.rb +24 -0
- data/lib/conductor/http/models/poll_data.rb +33 -0
- data/lib/conductor/http/models/prompt_template.rb +59 -0
- data/lib/conductor/http/models/prompt_template_test_request.rb +43 -0
- data/lib/conductor/http/models/rerun_workflow_request.rb +37 -0
- data/lib/conductor/http/models/role.rb +27 -0
- data/lib/conductor/http/models/schema_def.rb +59 -0
- data/lib/conductor/http/models/search_result.rb +187 -0
- data/lib/conductor/http/models/skip_task_request.rb +27 -0
- data/lib/conductor/http/models/start_workflow_request.rb +68 -0
- data/lib/conductor/http/models/subject_ref.rb +35 -0
- data/lib/conductor/http/models/tag_object.rb +36 -0
- data/lib/conductor/http/models/target_ref.rb +39 -0
- data/lib/conductor/http/models/task.rb +156 -0
- data/lib/conductor/http/models/task_def.rb +95 -0
- data/lib/conductor/http/models/task_exec_log.rb +30 -0
- data/lib/conductor/http/models/task_result.rb +115 -0
- data/lib/conductor/http/models/task_result_status.rb +24 -0
- data/lib/conductor/http/models/token.rb +33 -0
- data/lib/conductor/http/models/upsert_group_request.rb +30 -0
- data/lib/conductor/http/models/upsert_user_request.rb +39 -0
- data/lib/conductor/http/models/workflow.rb +202 -0
- data/lib/conductor/http/models/workflow_def.rb +73 -0
- data/lib/conductor/http/models/workflow_schedule.rb +100 -0
- data/lib/conductor/http/models/workflow_state_update.rb +30 -0
- data/lib/conductor/http/models/workflow_status_constants.rb +57 -0
- data/lib/conductor/http/models/workflow_task.rb +169 -0
- data/lib/conductor/http/models/workflow_test_request.rb +67 -0
- data/lib/conductor/http/rest_client.rb +211 -0
- data/lib/conductor/orkes/models/access_key.rb +56 -0
- data/lib/conductor/orkes/models/granted_permission.rb +27 -0
- data/lib/conductor/orkes/models/metadata_tag.rb +15 -0
- data/lib/conductor/orkes/models/rate_limit_tag.rb +15 -0
- data/lib/conductor/orkes/orkes_clients.rb +69 -0
- data/lib/conductor/version.rb +5 -0
- data/lib/conductor/worker/events/conductor_event.rb +40 -0
- data/lib/conductor/worker/events/global_dispatcher.rb +37 -0
- data/lib/conductor/worker/events/http_events.rb +25 -0
- data/lib/conductor/worker/events/listener_registry.rb +40 -0
- data/lib/conductor/worker/events/listeners.rb +34 -0
- data/lib/conductor/worker/events/sync_event_dispatcher.rb +78 -0
- data/lib/conductor/worker/events/task_runner_events.rb +271 -0
- data/lib/conductor/worker/events/workflow_events.rb +49 -0
- data/lib/conductor/worker/fiber_executor.rb +532 -0
- data/lib/conductor/worker/ractor_task_runner.rb +501 -0
- data/lib/conductor/worker/task_context.rb +114 -0
- data/lib/conductor/worker/task_definition_registrar.rb +322 -0
- data/lib/conductor/worker/task_handler.rb +360 -0
- data/lib/conductor/worker/task_in_progress.rb +60 -0
- data/lib/conductor/worker/task_runner.rb +538 -0
- data/lib/conductor/worker/telemetry/metrics_collector.rb +196 -0
- data/lib/conductor/worker/telemetry/prometheus_backend.rb +224 -0
- data/lib/conductor/worker/worker.rb +355 -0
- data/lib/conductor/worker/worker_config.rb +154 -0
- data/lib/conductor/worker/worker_registry.rb +71 -0
- data/lib/conductor/workflow/dsl/input_ref.rb +37 -0
- data/lib/conductor/workflow/dsl/output_ref.rb +44 -0
- data/lib/conductor/workflow/dsl/parallel_builder.rb +49 -0
- data/lib/conductor/workflow/dsl/switch_builder.rb +74 -0
- data/lib/conductor/workflow/dsl/task_ref.rb +178 -0
- data/lib/conductor/workflow/dsl/workflow_builder.rb +1016 -0
- data/lib/conductor/workflow/dsl/workflow_definition.rb +150 -0
- data/lib/conductor/workflow/llm/chat_message.rb +47 -0
- data/lib/conductor/workflow/llm/embedding_model.rb +19 -0
- data/lib/conductor/workflow/llm/tool_call.rb +43 -0
- data/lib/conductor/workflow/llm/tool_spec.rb +46 -0
- data/lib/conductor/workflow/task_type.rb +68 -0
- data/lib/conductor/workflow/timeout_policy.rb +31 -0
- data/lib/conductor/workflow/workflow_executor.rb +373 -0
- data/lib/conductor.rb +192 -0
- metadata +359 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conductor
|
|
4
|
+
module Http
|
|
5
|
+
module Models
|
|
6
|
+
# Workflow execution model representing a running or completed workflow instance
|
|
7
|
+
class Workflow < BaseModel
|
|
8
|
+
SWAGGER_TYPES = {
|
|
9
|
+
workflow_id: 'String',
|
|
10
|
+
parent_workflow_id: 'String',
|
|
11
|
+
parent_workflow_task_id: 'String',
|
|
12
|
+
correlation_id: 'String',
|
|
13
|
+
workflow_name: 'String',
|
|
14
|
+
workflow_version: 'Integer',
|
|
15
|
+
workflow_definition: 'WorkflowDef',
|
|
16
|
+
status: 'String',
|
|
17
|
+
input: 'Hash<String, Object>',
|
|
18
|
+
output: 'Hash<String, Object>',
|
|
19
|
+
tasks: 'Array<Task>',
|
|
20
|
+
start_time: 'Integer',
|
|
21
|
+
end_time: 'Integer',
|
|
22
|
+
update_time: 'Integer',
|
|
23
|
+
variables: 'Hash<String, Object>',
|
|
24
|
+
external_input_payload_storage_path: 'String',
|
|
25
|
+
external_output_payload_storage_path: 'String',
|
|
26
|
+
priority: 'Integer',
|
|
27
|
+
task_to_domain: 'Hash<String, String>',
|
|
28
|
+
failed_reference_task_names: 'Array<String>',
|
|
29
|
+
reason_for_incompletion: 'String',
|
|
30
|
+
owner_app: 'String',
|
|
31
|
+
created_by: 'String',
|
|
32
|
+
event: 'String',
|
|
33
|
+
last_retried_time: 'Integer'
|
|
34
|
+
}.freeze
|
|
35
|
+
|
|
36
|
+
ATTRIBUTE_MAP = {
|
|
37
|
+
workflow_id: :workflowId,
|
|
38
|
+
parent_workflow_id: :parentWorkflowId,
|
|
39
|
+
parent_workflow_task_id: :parentWorkflowTaskId,
|
|
40
|
+
correlation_id: :correlationId,
|
|
41
|
+
workflow_name: :workflowName,
|
|
42
|
+
workflow_version: :workflowVersion,
|
|
43
|
+
workflow_definition: :workflowDefinition,
|
|
44
|
+
status: :status,
|
|
45
|
+
input: :input,
|
|
46
|
+
output: :output,
|
|
47
|
+
tasks: :tasks,
|
|
48
|
+
start_time: :startTime,
|
|
49
|
+
end_time: :endTime,
|
|
50
|
+
update_time: :updateTime,
|
|
51
|
+
variables: :variables,
|
|
52
|
+
external_input_payload_storage_path: :externalInputPayloadStoragePath,
|
|
53
|
+
external_output_payload_storage_path: :externalOutputPayloadStoragePath,
|
|
54
|
+
priority: :priority,
|
|
55
|
+
task_to_domain: :taskToDomain,
|
|
56
|
+
failed_reference_task_names: :failedReferenceTaskNames,
|
|
57
|
+
reason_for_incompletion: :reasonForIncompletion,
|
|
58
|
+
owner_app: :ownerApp,
|
|
59
|
+
created_by: :createdBy,
|
|
60
|
+
event: :event,
|
|
61
|
+
last_retried_time: :lastRetriedTime
|
|
62
|
+
}.freeze
|
|
63
|
+
|
|
64
|
+
attr_accessor :workflow_id, :parent_workflow_id, :parent_workflow_task_id,
|
|
65
|
+
:correlation_id, :workflow_name, :workflow_version,
|
|
66
|
+
:workflow_definition, :status, :input, :output, :tasks,
|
|
67
|
+
:start_time, :end_time, :update_time, :variables,
|
|
68
|
+
:external_input_payload_storage_path,
|
|
69
|
+
:external_output_payload_storage_path, :priority,
|
|
70
|
+
:task_to_domain, :failed_reference_task_names,
|
|
71
|
+
:reason_for_incompletion, :owner_app, :created_by,
|
|
72
|
+
:event, :last_retried_time
|
|
73
|
+
|
|
74
|
+
def initialize(params = {})
|
|
75
|
+
@workflow_id = params[:workflow_id]
|
|
76
|
+
@parent_workflow_id = params[:parent_workflow_id]
|
|
77
|
+
@parent_workflow_task_id = params[:parent_workflow_task_id]
|
|
78
|
+
@correlation_id = params[:correlation_id]
|
|
79
|
+
@workflow_name = params[:workflow_name]
|
|
80
|
+
@workflow_version = params[:workflow_version]
|
|
81
|
+
@workflow_definition = params[:workflow_definition]
|
|
82
|
+
@status = params[:status]
|
|
83
|
+
@input = params[:input] || {}
|
|
84
|
+
@output = params[:output] || {}
|
|
85
|
+
@tasks = params[:tasks] || []
|
|
86
|
+
@start_time = params[:start_time]
|
|
87
|
+
@end_time = params[:end_time]
|
|
88
|
+
@update_time = params[:update_time]
|
|
89
|
+
@variables = params[:variables] || {}
|
|
90
|
+
@external_input_payload_storage_path = params[:external_input_payload_storage_path]
|
|
91
|
+
@external_output_payload_storage_path = params[:external_output_payload_storage_path]
|
|
92
|
+
@priority = params[:priority]
|
|
93
|
+
@task_to_domain = params[:task_to_domain]
|
|
94
|
+
@failed_reference_task_names = params[:failed_reference_task_names] || []
|
|
95
|
+
@reason_for_incompletion = params[:reason_for_incompletion]
|
|
96
|
+
@owner_app = params[:owner_app]
|
|
97
|
+
@created_by = params[:created_by]
|
|
98
|
+
@event = params[:event]
|
|
99
|
+
@last_retried_time = params[:last_retried_time]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Check if workflow is in terminal state
|
|
103
|
+
# @return [Boolean]
|
|
104
|
+
def terminal?
|
|
105
|
+
WorkflowStatusConstants.terminal?(status)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Check if workflow completed successfully
|
|
109
|
+
# @return [Boolean]
|
|
110
|
+
def completed?
|
|
111
|
+
status == WorkflowStatusConstants::COMPLETED
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Check if workflow failed
|
|
115
|
+
# @return [Boolean]
|
|
116
|
+
def failed?
|
|
117
|
+
status == WorkflowStatusConstants::FAILED
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Check if workflow is running
|
|
121
|
+
# @return [Boolean]
|
|
122
|
+
def running?
|
|
123
|
+
status == WorkflowStatusConstants::RUNNING
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Check if workflow is paused
|
|
127
|
+
# @return [Boolean]
|
|
128
|
+
def paused?
|
|
129
|
+
status == WorkflowStatusConstants::PAUSED
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Get a task by reference name
|
|
133
|
+
# @param ref_name [String] Task reference name
|
|
134
|
+
# @return [Task, nil]
|
|
135
|
+
def task_by_ref(ref_name)
|
|
136
|
+
tasks&.find { |t| t.reference_task_name == ref_name }
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# WorkflowRun represents the result of executing a workflow synchronously
|
|
141
|
+
class WorkflowRun < BaseModel
|
|
142
|
+
SWAGGER_TYPES = {
|
|
143
|
+
workflow_id: 'String',
|
|
144
|
+
correlation_id: 'String',
|
|
145
|
+
status: 'String',
|
|
146
|
+
input: 'Hash<String, Object>',
|
|
147
|
+
output: 'Hash<String, Object>',
|
|
148
|
+
tasks: 'Array<Task>',
|
|
149
|
+
request_id: 'String',
|
|
150
|
+
created_by: 'String',
|
|
151
|
+
variables: 'Hash<String, Object>',
|
|
152
|
+
priority: 'Integer',
|
|
153
|
+
reason_for_incompletion: 'String'
|
|
154
|
+
}.freeze
|
|
155
|
+
|
|
156
|
+
ATTRIBUTE_MAP = {
|
|
157
|
+
workflow_id: :workflowId,
|
|
158
|
+
correlation_id: :correlationId,
|
|
159
|
+
status: :status,
|
|
160
|
+
input: :input,
|
|
161
|
+
output: :output,
|
|
162
|
+
tasks: :tasks,
|
|
163
|
+
request_id: :requestId,
|
|
164
|
+
created_by: :createdBy,
|
|
165
|
+
variables: :variables,
|
|
166
|
+
priority: :priority,
|
|
167
|
+
reason_for_incompletion: :reasonForIncompletion
|
|
168
|
+
}.freeze
|
|
169
|
+
|
|
170
|
+
attr_accessor :workflow_id, :correlation_id, :status, :input, :output,
|
|
171
|
+
:tasks, :request_id, :created_by, :variables, :priority,
|
|
172
|
+
:reason_for_incompletion
|
|
173
|
+
|
|
174
|
+
def initialize(params = {})
|
|
175
|
+
@workflow_id = params[:workflow_id]
|
|
176
|
+
@correlation_id = params[:correlation_id]
|
|
177
|
+
@status = params[:status]
|
|
178
|
+
@input = params[:input] || {}
|
|
179
|
+
@output = params[:output] || {}
|
|
180
|
+
@tasks = params[:tasks] || []
|
|
181
|
+
@request_id = params[:request_id]
|
|
182
|
+
@created_by = params[:created_by]
|
|
183
|
+
@variables = params[:variables] || {}
|
|
184
|
+
@priority = params[:priority]
|
|
185
|
+
@reason_for_incompletion = params[:reason_for_incompletion]
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Check if workflow completed successfully
|
|
189
|
+
# @return [Boolean]
|
|
190
|
+
def completed?
|
|
191
|
+
status == WorkflowStatusConstants::COMPLETED
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Check if workflow is still running
|
|
195
|
+
# @return [Boolean]
|
|
196
|
+
def running?
|
|
197
|
+
status == WorkflowStatusConstants::RUNNING
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conductor
|
|
4
|
+
module Http
|
|
5
|
+
module Models
|
|
6
|
+
# Workflow definition model for registering workflows with Conductor
|
|
7
|
+
class WorkflowDef < BaseModel
|
|
8
|
+
SWAGGER_TYPES = {
|
|
9
|
+
name: 'String',
|
|
10
|
+
description: 'String',
|
|
11
|
+
version: 'Integer',
|
|
12
|
+
tasks: 'Array<WorkflowTask>',
|
|
13
|
+
input_parameters: 'Array<String>',
|
|
14
|
+
output_parameters: 'Hash<String, Object>',
|
|
15
|
+
failure_workflow: 'String',
|
|
16
|
+
schema_version: 'Integer',
|
|
17
|
+
restartable: 'Boolean',
|
|
18
|
+
workflow_status_listener_enabled: 'Boolean',
|
|
19
|
+
workflow_status_listener_sink: 'String',
|
|
20
|
+
owner_email: 'String',
|
|
21
|
+
timeout_policy: 'String',
|
|
22
|
+
timeout_seconds: 'Integer',
|
|
23
|
+
variables: 'Hash<String, Object>',
|
|
24
|
+
input_template: 'Hash<String, Object>'
|
|
25
|
+
}.freeze
|
|
26
|
+
|
|
27
|
+
ATTRIBUTE_MAP = {
|
|
28
|
+
name: :name,
|
|
29
|
+
description: :description,
|
|
30
|
+
version: :version,
|
|
31
|
+
tasks: :tasks,
|
|
32
|
+
input_parameters: :inputParameters,
|
|
33
|
+
output_parameters: :outputParameters,
|
|
34
|
+
failure_workflow: :failureWorkflow,
|
|
35
|
+
schema_version: :schemaVersion,
|
|
36
|
+
restartable: :restartable,
|
|
37
|
+
workflow_status_listener_enabled: :workflowStatusListenerEnabled,
|
|
38
|
+
workflow_status_listener_sink: :workflowStatusListenerSink,
|
|
39
|
+
owner_email: :ownerEmail,
|
|
40
|
+
timeout_policy: :timeoutPolicy,
|
|
41
|
+
timeout_seconds: :timeoutSeconds,
|
|
42
|
+
variables: :variables,
|
|
43
|
+
input_template: :inputTemplate
|
|
44
|
+
}.freeze
|
|
45
|
+
|
|
46
|
+
attr_accessor :name, :description, :version, :tasks, :input_parameters,
|
|
47
|
+
:output_parameters, :failure_workflow, :schema_version,
|
|
48
|
+
:restartable, :workflow_status_listener_enabled,
|
|
49
|
+
:workflow_status_listener_sink, :owner_email, :timeout_policy,
|
|
50
|
+
:timeout_seconds, :variables, :input_template
|
|
51
|
+
|
|
52
|
+
def initialize(params = {})
|
|
53
|
+
@name = params[:name]
|
|
54
|
+
@description = params[:description]
|
|
55
|
+
@version = params[:version]
|
|
56
|
+
@tasks = params[:tasks] || []
|
|
57
|
+
@input_parameters = params[:input_parameters] || []
|
|
58
|
+
@output_parameters = params[:output_parameters] || {}
|
|
59
|
+
@failure_workflow = params[:failure_workflow]
|
|
60
|
+
@schema_version = params[:schema_version] || 2
|
|
61
|
+
@restartable = params[:restartable].nil? ? true : params[:restartable]
|
|
62
|
+
@workflow_status_listener_enabled = params[:workflow_status_listener_enabled] || false
|
|
63
|
+
@workflow_status_listener_sink = params[:workflow_status_listener_sink]
|
|
64
|
+
@owner_email = params[:owner_email]
|
|
65
|
+
@timeout_policy = params[:timeout_policy]
|
|
66
|
+
@timeout_seconds = params[:timeout_seconds] || 60
|
|
67
|
+
@variables = params[:variables] || {}
|
|
68
|
+
@input_template = params[:input_template] || {}
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conductor
|
|
4
|
+
module Http
|
|
5
|
+
module Models
|
|
6
|
+
# Workflow schedule definition
|
|
7
|
+
class SaveScheduleRequest < BaseModel
|
|
8
|
+
SWAGGER_TYPES = {
|
|
9
|
+
name: 'String',
|
|
10
|
+
cron_expression: 'String',
|
|
11
|
+
start_workflow_request: 'StartWorkflowRequest',
|
|
12
|
+
paused: 'Boolean',
|
|
13
|
+
run_catchup_schedule_instances: 'Boolean',
|
|
14
|
+
schedule_start_time: 'Integer',
|
|
15
|
+
schedule_end_time: 'Integer',
|
|
16
|
+
created_by: 'String',
|
|
17
|
+
updated_by: 'String'
|
|
18
|
+
}.freeze
|
|
19
|
+
|
|
20
|
+
ATTRIBUTE_MAP = {
|
|
21
|
+
name: :name,
|
|
22
|
+
cron_expression: :cronExpression,
|
|
23
|
+
start_workflow_request: :startWorkflowRequest,
|
|
24
|
+
paused: :paused,
|
|
25
|
+
run_catchup_schedule_instances: :runCatchupScheduleInstances,
|
|
26
|
+
schedule_start_time: :scheduleStartTime,
|
|
27
|
+
schedule_end_time: :scheduleEndTime,
|
|
28
|
+
created_by: :createdBy,
|
|
29
|
+
updated_by: :updatedBy
|
|
30
|
+
}.freeze
|
|
31
|
+
|
|
32
|
+
attr_accessor :name, :cron_expression, :start_workflow_request, :paused,
|
|
33
|
+
:run_catchup_schedule_instances, :schedule_start_time,
|
|
34
|
+
:schedule_end_time, :created_by, :updated_by
|
|
35
|
+
|
|
36
|
+
def initialize(params = {})
|
|
37
|
+
@name = params[:name]
|
|
38
|
+
@cron_expression = params[:cron_expression]
|
|
39
|
+
@start_workflow_request = params[:start_workflow_request]
|
|
40
|
+
@paused = params.fetch(:paused, false)
|
|
41
|
+
@run_catchup_schedule_instances = params.fetch(:run_catchup_schedule_instances, false)
|
|
42
|
+
@schedule_start_time = params[:schedule_start_time]
|
|
43
|
+
@schedule_end_time = params[:schedule_end_time]
|
|
44
|
+
@created_by = params[:created_by]
|
|
45
|
+
@updated_by = params[:updated_by]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Workflow schedule (returned from server)
|
|
50
|
+
class WorkflowSchedule < BaseModel
|
|
51
|
+
SWAGGER_TYPES = {
|
|
52
|
+
name: 'String',
|
|
53
|
+
cron_expression: 'String',
|
|
54
|
+
start_workflow_request: 'StartWorkflowRequest',
|
|
55
|
+
paused: 'Boolean',
|
|
56
|
+
run_catchup_schedule_instances: 'Boolean',
|
|
57
|
+
schedule_start_time: 'Integer',
|
|
58
|
+
schedule_end_time: 'Integer',
|
|
59
|
+
create_time: 'Integer',
|
|
60
|
+
updated_time: 'Integer',
|
|
61
|
+
created_by: 'String',
|
|
62
|
+
updated_by: 'String'
|
|
63
|
+
}.freeze
|
|
64
|
+
|
|
65
|
+
ATTRIBUTE_MAP = {
|
|
66
|
+
name: :name,
|
|
67
|
+
cron_expression: :cronExpression,
|
|
68
|
+
start_workflow_request: :startWorkflowRequest,
|
|
69
|
+
paused: :paused,
|
|
70
|
+
run_catchup_schedule_instances: :runCatchupScheduleInstances,
|
|
71
|
+
schedule_start_time: :scheduleStartTime,
|
|
72
|
+
schedule_end_time: :scheduleEndTime,
|
|
73
|
+
create_time: :createTime,
|
|
74
|
+
updated_time: :updatedTime,
|
|
75
|
+
created_by: :createdBy,
|
|
76
|
+
updated_by: :updatedBy
|
|
77
|
+
}.freeze
|
|
78
|
+
|
|
79
|
+
attr_accessor :name, :cron_expression, :start_workflow_request, :paused,
|
|
80
|
+
:run_catchup_schedule_instances, :schedule_start_time,
|
|
81
|
+
:schedule_end_time, :create_time, :updated_time,
|
|
82
|
+
:created_by, :updated_by
|
|
83
|
+
|
|
84
|
+
def initialize(params = {})
|
|
85
|
+
@name = params[:name]
|
|
86
|
+
@cron_expression = params[:cron_expression]
|
|
87
|
+
@start_workflow_request = params[:start_workflow_request]
|
|
88
|
+
@paused = params.fetch(:paused, false)
|
|
89
|
+
@run_catchup_schedule_instances = params.fetch(:run_catchup_schedule_instances, false)
|
|
90
|
+
@schedule_start_time = params[:schedule_start_time]
|
|
91
|
+
@schedule_end_time = params[:schedule_end_time]
|
|
92
|
+
@create_time = params[:create_time]
|
|
93
|
+
@updated_time = params[:updated_time]
|
|
94
|
+
@created_by = params[:created_by]
|
|
95
|
+
@updated_by = params[:updated_by]
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conductor
|
|
4
|
+
module Http
|
|
5
|
+
module Models
|
|
6
|
+
# Request to update workflow state (variables and/or task state)
|
|
7
|
+
class WorkflowStateUpdate < BaseModel
|
|
8
|
+
SWAGGER_TYPES = {
|
|
9
|
+
task_reference_name: 'String',
|
|
10
|
+
task_result: 'TaskResult',
|
|
11
|
+
variables: 'Hash<String, Object>'
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
ATTRIBUTE_MAP = {
|
|
15
|
+
task_reference_name: :taskReferenceName,
|
|
16
|
+
task_result: :taskResult,
|
|
17
|
+
variables: :variables
|
|
18
|
+
}.freeze
|
|
19
|
+
|
|
20
|
+
attr_accessor :task_reference_name, :task_result, :variables
|
|
21
|
+
|
|
22
|
+
def initialize(params = {})
|
|
23
|
+
@task_reference_name = params[:task_reference_name]
|
|
24
|
+
@task_result = params[:task_result]
|
|
25
|
+
@variables = params[:variables] || {}
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conductor
|
|
4
|
+
module Http
|
|
5
|
+
module Models
|
|
6
|
+
# WorkflowStatus constants and helper methods
|
|
7
|
+
module WorkflowStatusConstants
|
|
8
|
+
# Status values
|
|
9
|
+
RUNNING = 'RUNNING'
|
|
10
|
+
COMPLETED = 'COMPLETED'
|
|
11
|
+
FAILED = 'FAILED'
|
|
12
|
+
TIMED_OUT = 'TIMED_OUT'
|
|
13
|
+
TERMINATED = 'TERMINATED'
|
|
14
|
+
PAUSED = 'PAUSED'
|
|
15
|
+
|
|
16
|
+
ALL = [RUNNING, COMPLETED, FAILED, TIMED_OUT, TERMINATED, PAUSED].freeze
|
|
17
|
+
|
|
18
|
+
# Terminal statuses - workflow has ended
|
|
19
|
+
TERMINAL_STATUSES = [COMPLETED, FAILED, TIMED_OUT, TERMINATED].freeze
|
|
20
|
+
|
|
21
|
+
# Successful statuses
|
|
22
|
+
SUCCESSFUL_STATUSES = [PAUSED, COMPLETED].freeze
|
|
23
|
+
|
|
24
|
+
# Running statuses
|
|
25
|
+
RUNNING_STATUSES = [RUNNING, PAUSED].freeze
|
|
26
|
+
|
|
27
|
+
# Check if the given status is valid
|
|
28
|
+
# @param [String] status The status to validate
|
|
29
|
+
# @return [Boolean] true if valid, false otherwise
|
|
30
|
+
def self.valid?(status)
|
|
31
|
+
ALL.include?(status)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Check if status is terminal (workflow has ended)
|
|
35
|
+
# @param [String] status The status to check
|
|
36
|
+
# @return [Boolean] true if terminal, false otherwise
|
|
37
|
+
def self.terminal?(status)
|
|
38
|
+
TERMINAL_STATUSES.include?(status)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Check if status is successful
|
|
42
|
+
# @param [String] status The status to check
|
|
43
|
+
# @return [Boolean] true if successful, false otherwise
|
|
44
|
+
def self.successful?(status)
|
|
45
|
+
SUCCESSFUL_STATUSES.include?(status)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Check if status is running
|
|
49
|
+
# @param [String] status The status to check
|
|
50
|
+
# @return [Boolean] true if running, false otherwise
|
|
51
|
+
def self.running?(status)
|
|
52
|
+
RUNNING_STATUSES.include?(status)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conductor
|
|
4
|
+
module Http
|
|
5
|
+
module Models
|
|
6
|
+
# Represents a workflow task definition within a workflow
|
|
7
|
+
# Used for serialization to/from JSON when registering workflows
|
|
8
|
+
class WorkflowTask < BaseModel
|
|
9
|
+
SWAGGER_TYPES = {
|
|
10
|
+
name: 'String',
|
|
11
|
+
task_reference_name: 'String',
|
|
12
|
+
type: 'String',
|
|
13
|
+
description: 'String',
|
|
14
|
+
optional: 'Boolean',
|
|
15
|
+
input_parameters: 'Hash<String, Object>',
|
|
16
|
+
dynamic_task_name_param: 'String',
|
|
17
|
+
case_value_param: 'String',
|
|
18
|
+
case_expression: 'String',
|
|
19
|
+
script_expression: 'String',
|
|
20
|
+
decision_cases: 'Hash<String, Array<WorkflowTask>>',
|
|
21
|
+
dynamic_fork_join_tasks_param: 'String',
|
|
22
|
+
dynamic_fork_tasks_param: 'String',
|
|
23
|
+
dynamic_fork_tasks_input_param_name: 'String',
|
|
24
|
+
default_case: 'Array<WorkflowTask>',
|
|
25
|
+
fork_tasks: 'Array<Array<WorkflowTask>>',
|
|
26
|
+
start_delay: 'Integer',
|
|
27
|
+
sub_workflow_param: 'SubWorkflowParams',
|
|
28
|
+
join_on: 'Array<String>',
|
|
29
|
+
sink: 'String',
|
|
30
|
+
task_definition: 'Object',
|
|
31
|
+
rate_limited: 'Boolean',
|
|
32
|
+
default_exclusive_join_task: 'Array<String>',
|
|
33
|
+
async_complete: 'Boolean',
|
|
34
|
+
loop_condition: 'String',
|
|
35
|
+
loop_over: 'Array<WorkflowTask>',
|
|
36
|
+
retry_count: 'Integer',
|
|
37
|
+
evaluator_type: 'String',
|
|
38
|
+
expression: 'String',
|
|
39
|
+
workflow_task_type: 'String',
|
|
40
|
+
cache_config: 'CacheConfig'
|
|
41
|
+
}.freeze
|
|
42
|
+
|
|
43
|
+
ATTRIBUTE_MAP = {
|
|
44
|
+
name: :name,
|
|
45
|
+
task_reference_name: :taskReferenceName,
|
|
46
|
+
type: :type,
|
|
47
|
+
description: :description,
|
|
48
|
+
optional: :optional,
|
|
49
|
+
input_parameters: :inputParameters,
|
|
50
|
+
dynamic_task_name_param: :dynamicTaskNameParam,
|
|
51
|
+
case_value_param: :caseValueParam,
|
|
52
|
+
case_expression: :caseExpression,
|
|
53
|
+
script_expression: :scriptExpression,
|
|
54
|
+
decision_cases: :decisionCases,
|
|
55
|
+
dynamic_fork_join_tasks_param: :dynamicForkJoinTasksParam,
|
|
56
|
+
dynamic_fork_tasks_param: :dynamicForkTasksParam,
|
|
57
|
+
dynamic_fork_tasks_input_param_name: :dynamicForkTasksInputParamName,
|
|
58
|
+
default_case: :defaultCase,
|
|
59
|
+
fork_tasks: :forkTasks,
|
|
60
|
+
start_delay: :startDelay,
|
|
61
|
+
sub_workflow_param: :subWorkflowParam,
|
|
62
|
+
join_on: :joinOn,
|
|
63
|
+
sink: :sink,
|
|
64
|
+
task_definition: :taskDefinition,
|
|
65
|
+
rate_limited: :rateLimited,
|
|
66
|
+
default_exclusive_join_task: :defaultExclusiveJoinTask,
|
|
67
|
+
async_complete: :asyncComplete,
|
|
68
|
+
loop_condition: :loopCondition,
|
|
69
|
+
loop_over: :loopOver,
|
|
70
|
+
retry_count: :retryCount,
|
|
71
|
+
evaluator_type: :evaluatorType,
|
|
72
|
+
expression: :expression,
|
|
73
|
+
workflow_task_type: :workflowTaskType,
|
|
74
|
+
cache_config: :cacheConfig
|
|
75
|
+
}.freeze
|
|
76
|
+
|
|
77
|
+
attr_accessor :name, :task_reference_name, :type, :description, :optional,
|
|
78
|
+
:input_parameters, :dynamic_task_name_param, :case_value_param,
|
|
79
|
+
:case_expression, :script_expression, :decision_cases,
|
|
80
|
+
:dynamic_fork_join_tasks_param, :dynamic_fork_tasks_param,
|
|
81
|
+
:dynamic_fork_tasks_input_param_name, :default_case, :fork_tasks,
|
|
82
|
+
:start_delay, :sub_workflow_param, :join_on, :sink,
|
|
83
|
+
:task_definition, :rate_limited, :default_exclusive_join_task,
|
|
84
|
+
:async_complete, :loop_condition, :loop_over, :retry_count,
|
|
85
|
+
:evaluator_type, :expression, :workflow_task_type, :cache_config
|
|
86
|
+
|
|
87
|
+
def initialize(params = {})
|
|
88
|
+
@name = params[:name]
|
|
89
|
+
@task_reference_name = params[:task_reference_name]
|
|
90
|
+
@type = params[:type]
|
|
91
|
+
@description = params[:description]
|
|
92
|
+
@optional = params[:optional]
|
|
93
|
+
@input_parameters = params[:input_parameters] || {}
|
|
94
|
+
@dynamic_task_name_param = params[:dynamic_task_name_param]
|
|
95
|
+
@case_value_param = params[:case_value_param]
|
|
96
|
+
@case_expression = params[:case_expression]
|
|
97
|
+
@script_expression = params[:script_expression]
|
|
98
|
+
@decision_cases = params[:decision_cases]
|
|
99
|
+
@dynamic_fork_join_tasks_param = params[:dynamic_fork_join_tasks_param]
|
|
100
|
+
@dynamic_fork_tasks_param = params[:dynamic_fork_tasks_param]
|
|
101
|
+
@dynamic_fork_tasks_input_param_name = params[:dynamic_fork_tasks_input_param_name]
|
|
102
|
+
@default_case = params[:default_case]
|
|
103
|
+
@fork_tasks = params[:fork_tasks]
|
|
104
|
+
@start_delay = params[:start_delay]
|
|
105
|
+
@sub_workflow_param = params[:sub_workflow_param]
|
|
106
|
+
@join_on = params[:join_on]
|
|
107
|
+
@sink = params[:sink]
|
|
108
|
+
@task_definition = params[:task_definition]
|
|
109
|
+
@rate_limited = params[:rate_limited]
|
|
110
|
+
@default_exclusive_join_task = params[:default_exclusive_join_task]
|
|
111
|
+
@async_complete = params[:async_complete]
|
|
112
|
+
@loop_condition = params[:loop_condition]
|
|
113
|
+
@loop_over = params[:loop_over]
|
|
114
|
+
@retry_count = params[:retry_count]
|
|
115
|
+
@evaluator_type = params[:evaluator_type]
|
|
116
|
+
@expression = params[:expression]
|
|
117
|
+
@workflow_task_type = params[:workflow_task_type]
|
|
118
|
+
@cache_config = params[:cache_config]
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Cache configuration for tasks
|
|
123
|
+
class CacheConfig < BaseModel
|
|
124
|
+
SWAGGER_TYPES = {
|
|
125
|
+
key: 'String',
|
|
126
|
+
ttl_in_second: 'Integer'
|
|
127
|
+
}.freeze
|
|
128
|
+
|
|
129
|
+
ATTRIBUTE_MAP = {
|
|
130
|
+
key: :key,
|
|
131
|
+
ttl_in_second: :ttlInSecond
|
|
132
|
+
}.freeze
|
|
133
|
+
|
|
134
|
+
attr_accessor :key, :ttl_in_second
|
|
135
|
+
|
|
136
|
+
def initialize(params = {})
|
|
137
|
+
@key = params[:key]
|
|
138
|
+
@ttl_in_second = params[:ttl_in_second]
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Sub-workflow parameters for SUB_WORKFLOW tasks
|
|
143
|
+
class SubWorkflowParams < BaseModel
|
|
144
|
+
SWAGGER_TYPES = {
|
|
145
|
+
name: 'String',
|
|
146
|
+
version: 'Integer',
|
|
147
|
+
task_to_domain: 'Hash<String, String>',
|
|
148
|
+
workflow_definition: 'WorkflowDef'
|
|
149
|
+
}.freeze
|
|
150
|
+
|
|
151
|
+
ATTRIBUTE_MAP = {
|
|
152
|
+
name: :name,
|
|
153
|
+
version: :version,
|
|
154
|
+
task_to_domain: :taskToDomain,
|
|
155
|
+
workflow_definition: :workflowDefinition
|
|
156
|
+
}.freeze
|
|
157
|
+
|
|
158
|
+
attr_accessor :name, :version, :task_to_domain, :workflow_definition
|
|
159
|
+
|
|
160
|
+
def initialize(params = {})
|
|
161
|
+
@name = params[:name]
|
|
162
|
+
@version = params[:version]
|
|
163
|
+
@task_to_domain = params[:task_to_domain]
|
|
164
|
+
@workflow_definition = params[:workflow_definition]
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|