hatchet-sdk 0.7.0 → 0.8.1
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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +45 -0
- data/lib/hatchet/clients/rest/.openapi-generator/FILES +0 -5
- data/lib/hatchet/clients/rest/README.md +0 -9
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/worker_api.rb +3 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_runs_api.rb +3 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/feature_flag_id.rb +2 -1
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant.rb +14 -4
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker.rb +24 -4
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +0 -5
- data/lib/hatchet/concurrency.rb +82 -19
- data/lib/hatchet/contracts/dispatcher/dispatcher_pb.rb +1 -1
- data/lib/hatchet/contracts/v1/workflows_pb.rb +1 -1
- data/lib/hatchet/version.rb +1 -1
- data/lib/hatchet/worker/durable_event_listener.rb +71 -20
- data/sig/hatchet/concurrency.rbs +12 -2
- data/sig/hatchet/worker/durable_event_listener.rbs +3 -0
- metadata +2 -7
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/operator_api.rb +0 -405
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_http_operator_request.rb +0 -346
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator.rb +0 -372
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator_list.rb +0 -231
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_http_operator_request.rb +0 -252
|
@@ -9,7 +9,7 @@ require 'v1/shared/condition_pb'
|
|
|
9
9
|
require 'v1/shared/trigger_pb'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
descriptor_data = "\n\x12v1/workflows.proto\x12\x02v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19v1/shared/condition.proto\x1a\x17v1/shared/trigger.proto\"[\n\x12\x43\x61ncelTasksRequest\x12\x14\n\x0c\x65xternal_ids\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"[\n\x12ReplayTasksRequest\x12\x14\n\x0c\x65xternal_ids\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"\xb7\x01\n\x0bTasksFilter\x12\x10\n\x08statuses\x18\x01 \x03(\t\x12)\n\x05since\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x05until\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x12\x14\n\x0cworkflow_ids\x18\x04 \x03(\t\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x05 \x03(\tB\x08\n\x06_until\".\n\x13\x43\x61ncelTasksResponse\x12\x17\n\x0f\x63\x61ncelled_tasks\x18\x01 \x03(\t\"-\n\x13ReplayTasksResponse\x12\x16\n\x0ereplayed_tasks\x18\x01 \x03(\t\"\xae\x02\n\x19TriggerWorkflowRunRequest\x12\x15\n\rworkflow_name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\x0c\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x03 \x01(\x0c\x12\x15\n\x08priority\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12U\n\x15\x64\x65sired_worker_labels\x18\x05 \x03(\x0b\x32\x36.v1.TriggerWorkflowRunRequest.DesiredWorkerLabelsEntry\x1aS\n\x18\x44\x65siredWorkerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.v1.DesiredWorkerLabels:\x02\x38\x01\x42\x0b\n\t_priority\"1\n\x1aTriggerWorkflowRunResponse\x12\x13\n\x0b\x65xternal_id\x18\x01 \x01(\t\"X\n\x18\x42ranchDurableTaskRequest\x12\x18\n\x10task_external_id\x18\x01 \x01(\t\x12\x0f\n\x07node_id\x18\x02 \x01(\x03\x12\x11\n\tbranch_id\x18\x03 \x01(\x03\"Y\n\x19\x42ranchDurableTaskResponse\x12\x18\n\x10task_external_id\x18\x01 \x01(\t\x12\x0f\n\x07node_id\x18\x02 \x01(\x03\x12\x11\n\tbranch_id\x18\x03 \x01(\x03\"\xed\x04\n\x1c\x43reateWorkflowVersionRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0f\n\x07version\x18\x03 \x01(\t\x12\x16\n\x0e\x65vent_triggers\x18\x04 \x03(\t\x12\x15\n\rcron_triggers\x18\x05 \x03(\t\x12!\n\x05tasks\x18\x06 \x03(\x0b\x32\x12.v1.CreateTaskOpts\x12$\n\x0b\x63oncurrency\x18\x07 \x01(\x0b\x32\x0f.v1.Concurrency\x12\x17\n\ncron_input\x18\x08 \x01(\tH\x00\x88\x01\x01\x12\x30\n\x0fon_failure_task\x18\t \x01(\x0b\x32\x12.v1.CreateTaskOptsH\x01\x88\x01\x01\x12\'\n\x06sticky\x18\n \x01(\x0e\x32\x12.v1.StickyStrategyH\x02\x88\x01\x01\x12\x1d\n\x10\x64\x65\x66\x61ult_priority\x18\x0b \x01(\x05H\x03\x88\x01\x01\x12(\n\x0f\x63oncurrency_arr\x18\x0c \x03(\x0b\x32\x0f.v1.Concurrency\x12*\n\x0f\x64\x65\x66\x61ult_filters\x18\r \x03(\x0b\x32\x11.v1.DefaultFilter\x12\x1e\n\x11input_json_schema\x18\x0e \x01(\x0cH\x04\x88\x01\x01\x12/\n\x0bidempotency\x18\x0f \x01(\x0b\x32\x15.v1.IdempotencyConfigH\x05\x88\x01\x01\x42\r\n\x0b_cron_inputB\x12\n\x10_on_failure_taskB\t\n\x07_stickyB\x13\n\x11_default_priorityB\x14\n\x12_input_json_schemaB\x0e\n\x0c_idempotency\"n\n\x11IdempotencyConfig\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\x0e\n\x06ttl_ms\x18\x02 \x01(\x03\x12*\n\x06method\x18\x03 \x01(\x0e\x32\x15.v1.IdempotencyMethodH\x00\x88\x01\x01\x42\t\n\x07_method\"`\n\x19IdempotencyCollisionError\x12 \n\x18\x65xisting_run_external_id\x18\x01 \x01(\t\x12!\n\x19\x63olliding_run_external_id\x18\x02 \x01(\t\"\x87\x01\n$BulkTriggerIdempotencyCollisionError\x12,\n$successful_workflow_run_external_ids\x18\x01 \x03(\t\x12\x31\n\ncollisions\x18\x02 \x03(\x0b\x32\x1d.v1.IdempotencyCollisionError\"T\n\rDefaultFilter\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\r\n\x05scope\x18\x02 \x01(\t\x12\x14\n\x07payload\x18\x03 \x01(\x0cH\x00\x88\x01\x01\x42\n\n\x08_payload\"\
|
|
12
|
+
descriptor_data = "\n\x12v1/workflows.proto\x12\x02v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19v1/shared/condition.proto\x1a\x17v1/shared/trigger.proto\"[\n\x12\x43\x61ncelTasksRequest\x12\x14\n\x0c\x65xternal_ids\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"[\n\x12ReplayTasksRequest\x12\x14\n\x0c\x65xternal_ids\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"\xb7\x01\n\x0bTasksFilter\x12\x10\n\x08statuses\x18\x01 \x03(\t\x12)\n\x05since\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x05until\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x12\x14\n\x0cworkflow_ids\x18\x04 \x03(\t\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x05 \x03(\tB\x08\n\x06_until\".\n\x13\x43\x61ncelTasksResponse\x12\x17\n\x0f\x63\x61ncelled_tasks\x18\x01 \x03(\t\"-\n\x13ReplayTasksResponse\x12\x16\n\x0ereplayed_tasks\x18\x01 \x03(\t\"\xae\x02\n\x19TriggerWorkflowRunRequest\x12\x15\n\rworkflow_name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\x0c\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x03 \x01(\x0c\x12\x15\n\x08priority\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12U\n\x15\x64\x65sired_worker_labels\x18\x05 \x03(\x0b\x32\x36.v1.TriggerWorkflowRunRequest.DesiredWorkerLabelsEntry\x1aS\n\x18\x44\x65siredWorkerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.v1.DesiredWorkerLabels:\x02\x38\x01\x42\x0b\n\t_priority\"1\n\x1aTriggerWorkflowRunResponse\x12\x13\n\x0b\x65xternal_id\x18\x01 \x01(\t\"X\n\x18\x42ranchDurableTaskRequest\x12\x18\n\x10task_external_id\x18\x01 \x01(\t\x12\x0f\n\x07node_id\x18\x02 \x01(\x03\x12\x11\n\tbranch_id\x18\x03 \x01(\x03\"Y\n\x19\x42ranchDurableTaskResponse\x12\x18\n\x10task_external_id\x18\x01 \x01(\t\x12\x0f\n\x07node_id\x18\x02 \x01(\x03\x12\x11\n\tbranch_id\x18\x03 \x01(\x03\"\xed\x04\n\x1c\x43reateWorkflowVersionRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0f\n\x07version\x18\x03 \x01(\t\x12\x16\n\x0e\x65vent_triggers\x18\x04 \x03(\t\x12\x15\n\rcron_triggers\x18\x05 \x03(\t\x12!\n\x05tasks\x18\x06 \x03(\x0b\x32\x12.v1.CreateTaskOpts\x12$\n\x0b\x63oncurrency\x18\x07 \x01(\x0b\x32\x0f.v1.Concurrency\x12\x17\n\ncron_input\x18\x08 \x01(\tH\x00\x88\x01\x01\x12\x30\n\x0fon_failure_task\x18\t \x01(\x0b\x32\x12.v1.CreateTaskOptsH\x01\x88\x01\x01\x12\'\n\x06sticky\x18\n \x01(\x0e\x32\x12.v1.StickyStrategyH\x02\x88\x01\x01\x12\x1d\n\x10\x64\x65\x66\x61ult_priority\x18\x0b \x01(\x05H\x03\x88\x01\x01\x12(\n\x0f\x63oncurrency_arr\x18\x0c \x03(\x0b\x32\x0f.v1.Concurrency\x12*\n\x0f\x64\x65\x66\x61ult_filters\x18\r \x03(\x0b\x32\x11.v1.DefaultFilter\x12\x1e\n\x11input_json_schema\x18\x0e \x01(\x0cH\x04\x88\x01\x01\x12/\n\x0bidempotency\x18\x0f \x01(\x0b\x32\x15.v1.IdempotencyConfigH\x05\x88\x01\x01\x42\r\n\x0b_cron_inputB\x12\n\x10_on_failure_taskB\t\n\x07_stickyB\x13\n\x11_default_priorityB\x14\n\x12_input_json_schemaB\x0e\n\x0c_idempotency\"n\n\x11IdempotencyConfig\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\x0e\n\x06ttl_ms\x18\x02 \x01(\x03\x12*\n\x06method\x18\x03 \x01(\x0e\x32\x15.v1.IdempotencyMethodH\x00\x88\x01\x01\x42\t\n\x07_method\"`\n\x19IdempotencyCollisionError\x12 \n\x18\x65xisting_run_external_id\x18\x01 \x01(\t\x12!\n\x19\x63olliding_run_external_id\x18\x02 \x01(\t\"\x87\x01\n$BulkTriggerIdempotencyCollisionError\x12,\n$successful_workflow_run_external_ids\x18\x01 \x03(\t\x12\x31\n\ncollisions\x18\x02 \x03(\x0b\x32\x1d.v1.IdempotencyCollisionError\"T\n\rDefaultFilter\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\r\n\x05scope\x18\x02 \x01(\t\x12\x14\n\x07payload\x18\x03 \x01(\x0cH\x00\x88\x01\x01\x42\n\n\x08_payload\"\x9d\x02\n\x0b\x43oncurrency\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\x15\n\x08max_runs\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x39\n\x0elimit_strategy\x18\x03 \x01(\x0e\x32\x1c.v1.ConcurrencyLimitStrategyH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x1d\n\x10is_tenant_scoped\x18\x05 \x01(\x08H\x03\x88\x01\x01\x12 \n\x13max_runs_expression\x18\x06 \x01(\tH\x04\x88\x01\x01\x42\x0b\n\t_max_runsB\x11\n\x0f_limit_strategyB\x07\n\x05_nameB\x13\n\x11_is_tenant_scopedB\x16\n\x14_max_runs_expression\"\x89\x02\n\x0fTaskBatchConfig\x12\x16\n\x0e\x62\x61tch_max_size\x18\x01 \x01(\x05\x12\"\n\x15\x62\x61tch_max_interval_ms\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x1c\n\x0f\x62\x61tch_group_key\x18\x03 \x01(\tH\x01\x88\x01\x01\x12!\n\x14\x62\x61tch_group_max_runs\x18\x04 \x01(\x05H\x02\x88\x01\x01\x12\x1d\n\x10\x62roadcast_output\x18\x05 \x01(\x08H\x03\x88\x01\x01\x42\x18\n\x16_batch_max_interval_msB\x12\n\x10_batch_group_keyB\x17\n\x15_batch_group_max_runsB\x13\n\x11_broadcast_output\"\xea\x05\n\x0e\x43reateTaskOpts\x12\x13\n\x0breadable_id\x18\x01 \x01(\t\x12\x0e\n\x06\x61\x63tion\x18\x02 \x01(\t\x12\x0f\n\x07timeout\x18\x03 \x01(\t\x12\x0e\n\x06inputs\x18\x04 \x01(\t\x12\x0f\n\x07parents\x18\x05 \x03(\t\x12\x0f\n\x07retries\x18\x06 \x01(\x05\x12,\n\x0brate_limits\x18\x07 \x03(\x0b\x32\x17.v1.CreateTaskRateLimit\x12;\n\rworker_labels\x18\x08 \x03(\x0b\x32$.v1.CreateTaskOpts.WorkerLabelsEntry\x12\x1b\n\x0e\x62\x61\x63koff_factor\x18\t \x01(\x02H\x00\x88\x01\x01\x12 \n\x13\x62\x61\x63koff_max_seconds\x18\n \x01(\x05H\x01\x88\x01\x01\x12$\n\x0b\x63oncurrency\x18\x0b \x03(\x0b\x32\x0f.v1.Concurrency\x12+\n\nconditions\x18\x0c \x01(\x0b\x32\x12.v1.TaskConditionsH\x02\x88\x01\x01\x12\x1d\n\x10schedule_timeout\x18\r \x01(\tH\x03\x88\x01\x01\x12\x12\n\nis_durable\x18\x0e \x01(\x08\x12;\n\rslot_requests\x18\x0f \x03(\x0b\x32$.v1.CreateTaskOpts.SlotRequestsEntry\x12\'\n\x05\x62\x61tch\x18\x10 \x01(\x0b\x32\x13.v1.TaskBatchConfigH\x04\x88\x01\x01\x1aL\n\x11WorkerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.v1.DesiredWorkerLabels:\x02\x38\x01\x1a\x33\n\x11SlotRequestsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x42\x11\n\x0f_backoff_factorB\x16\n\x14_backoff_max_secondsB\r\n\x0b_conditionsB\x13\n\x11_schedule_timeoutB\x08\n\x06_batch\"\xfd\x01\n\x13\x43reateTaskRateLimit\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x12\n\x05units\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x15\n\x08key_expr\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x17\n\nunits_expr\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x1e\n\x11limit_values_expr\x18\x05 \x01(\tH\x03\x88\x01\x01\x12,\n\x08\x64uration\x18\x06 \x01(\x0e\x32\x15.v1.RateLimitDurationH\x04\x88\x01\x01\x42\x08\n\x06_unitsB\x0b\n\t_key_exprB\r\n\x0b_units_exprB\x14\n\x12_limit_values_exprB\x0b\n\t_duration\"@\n\x1d\x43reateWorkflowVersionResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\"+\n\x14GetRunDetailsRequest\x12\x13\n\x0b\x65xternal_id\x18\x01 \x01(\t\"\xaa\x01\n\rTaskRunDetail\x12\x13\n\x0b\x65xternal_id\x18\x01 \x01(\t\x12\x1d\n\x06status\x18\x02 \x01(\x0e\x32\r.v1.RunStatus\x12\x12\n\x05\x65rror\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06output\x18\x04 \x01(\x0cH\x01\x88\x01\x01\x12\x13\n\x0breadable_id\x18\x05 \x01(\t\x12\x12\n\nis_evicted\x18\x06 \x01(\x08\x42\x08\n\x06_errorB\t\n\x07_output\"\x84\x02\n\x15GetRunDetailsResponse\x12\r\n\x05input\x18\x01 \x01(\x0c\x12\x1d\n\x06status\x18\x02 \x01(\x0e\x32\r.v1.RunStatus\x12:\n\ttask_runs\x18\x03 \x03(\x0b\x32\'.v1.GetRunDetailsResponse.TaskRunsEntry\x12\x0c\n\x04\x64one\x18\x04 \x01(\x08\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x05 \x01(\x0c\x12\x12\n\nis_evicted\x18\x06 \x01(\x08\x1a\x42\n\rTaskRunsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.v1.TaskRunDetail:\x02\x38\x01*$\n\x0eStickyStrategy\x12\x08\n\x04SOFT\x10\x00\x12\x08\n\x04HARD\x10\x01*]\n\x11RateLimitDuration\x12\n\n\x06SECOND\x10\x00\x12\n\n\x06MINUTE\x10\x01\x12\x08\n\x04HOUR\x10\x02\x12\x07\n\x03\x44\x41Y\x10\x03\x12\x08\n\x04WEEK\x10\x04\x12\t\n\x05MONTH\x10\x05\x12\x08\n\x04YEAR\x10\x06*[\n\tRunStatus\x12\n\n\x06QUEUED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tCOMPLETED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\r\n\tCANCELLED\x10\x04\x12\x0b\n\x07\x45VICTED\x10\x05*(\n\x11IdempotencyMethod\x12\x07\n\x03TTL\x10\x00\x12\n\n\x06STATUS\x10\x01*\xc1\x01\n\x18\x43oncurrencyLimitStrategy\x12\x16\n\x12\x43\x41NCEL_IN_PROGRESS\x10\x00\x12\x0f\n\x0b\x44ROP_NEWEST\x10\x01\x12\x10\n\x0cQUEUE_NEWEST\x10\x02\x12\x15\n\x11GROUP_ROUND_ROBIN\x10\x03\x12\x11\n\rCANCEL_NEWEST\x10\x04\x12\x1f\n\x1b\x43\x41NCEL_QUEUED_EXCEPT_NEWEST\x10\x05\x12\x1f\n\x1b\x43\x41NCEL_QUEUED_EXCEPT_OLDEST\x10\x06\x32\xcf\x03\n\x0c\x41\x64minService\x12R\n\x0bPutWorkflow\x12 .v1.CreateWorkflowVersionRequest\x1a!.v1.CreateWorkflowVersionResponse\x12>\n\x0b\x43\x61ncelTasks\x12\x16.v1.CancelTasksRequest\x1a\x17.v1.CancelTasksResponse\x12>\n\x0bReplayTasks\x12\x16.v1.ReplayTasksRequest\x1a\x17.v1.ReplayTasksResponse\x12S\n\x12TriggerWorkflowRun\x12\x1d.v1.TriggerWorkflowRunRequest\x1a\x1e.v1.TriggerWorkflowRunResponse\x12\x44\n\rGetRunDetails\x12\x18.v1.GetRunDetailsRequest\x1a\x19.v1.GetRunDetailsResponse\x12P\n\x11\x42ranchDurableTask\x12\x1c.v1.BranchDurableTaskRequest\x1a\x1d.v1.BranchDurableTaskResponseBBZ@github.com/hatchet-dev/hatchet/internal/services/shared/proto/v1b\x06proto3"
|
|
13
13
|
|
|
14
14
|
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
15
15
|
pool.add_serialized_file(descriptor_data)
|
data/lib/hatchet/version.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
4
|
require "monitor"
|
|
5
|
+
require "set"
|
|
5
6
|
require "timeout"
|
|
6
7
|
|
|
7
8
|
module Hatchet
|
|
@@ -23,6 +24,9 @@ module Hatchet
|
|
|
23
24
|
DEFAULT_RECONNECT_INTERVAL = 3 # seconds
|
|
24
25
|
EVICTION_ACK_TIMEOUT_SECONDS = 30.0
|
|
25
26
|
REGISTER_WORKER_ACK_TIMEOUT_SECONDS = 10.0
|
|
27
|
+
WORKER_STATUS_RESEND_INTERVAL_SECONDS = 5.0
|
|
28
|
+
WORKER_STATUS_RESEND_MIN_PENDING_SECONDS = 2.0
|
|
29
|
+
WORKER_STATUS_MAX_ENTRIES_PER_REQUEST = 10_000
|
|
26
30
|
|
|
27
31
|
# Outgoing event sent via ``send_event``.
|
|
28
32
|
#
|
|
@@ -61,6 +65,10 @@ module Hatchet
|
|
|
61
65
|
@pending_eviction_acks = {}
|
|
62
66
|
# (task_external_id, invocation_count, branch_id, node_id) => Queue
|
|
63
67
|
@pending_callbacks = {}
|
|
68
|
+
# pending callback keys registered since the last worker status request
|
|
69
|
+
@newly_waiting_keys = Set.new
|
|
70
|
+
# pending callback key => monotonic time it was registered at
|
|
71
|
+
@waiting_since = {}
|
|
64
72
|
# key -> [inserted_at, result] (rudimentary TTL cache)
|
|
65
73
|
@buffered_completions = {}
|
|
66
74
|
|
|
@@ -158,6 +166,7 @@ module Hatchet
|
|
|
158
166
|
end
|
|
159
167
|
|
|
160
168
|
queue = @mu.synchronize do
|
|
169
|
+
register_waiting_key(key)
|
|
161
170
|
@pending_callbacks[key] ||= Queue.new
|
|
162
171
|
end
|
|
163
172
|
|
|
@@ -166,7 +175,7 @@ module Hatchet
|
|
|
166
175
|
"task=#{durable_task_external_id} invocation=#{invocation_count} " \
|
|
167
176
|
"branch_id=#{branch_id} node_id=#{node_id}",
|
|
168
177
|
)
|
|
169
|
-
|
|
178
|
+
enqueue_worker_status_for_newly_waiting_keys
|
|
170
179
|
|
|
171
180
|
result = await_queue(queue)
|
|
172
181
|
@logger&.debug(
|
|
@@ -355,7 +364,7 @@ module Hatchet
|
|
|
355
364
|
@stream = stub.durable_task(@request_enum, metadata: @config.auth_metadata)
|
|
356
365
|
|
|
357
366
|
register_worker
|
|
358
|
-
|
|
367
|
+
enqueue_full_worker_status
|
|
359
368
|
|
|
360
369
|
@logger&.info("durable event listener connected")
|
|
361
370
|
end
|
|
@@ -436,34 +445,76 @@ module Hatchet
|
|
|
436
445
|
)
|
|
437
446
|
end
|
|
438
447
|
|
|
439
|
-
def
|
|
440
|
-
|
|
448
|
+
def register_waiting_key(key)
|
|
449
|
+
@waiting_since[key] = monotonic_now
|
|
450
|
+
@newly_waiting_keys.add(key)
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
# Waiters that register at the same time share one request: whichever
|
|
454
|
+
# thread gets here first reports all of them, and the rest find nothing
|
|
455
|
+
# left to report.
|
|
456
|
+
def enqueue_worker_status_for_newly_waiting_keys
|
|
457
|
+
keys = @mu.synchronize do
|
|
458
|
+
newly_waiting = @newly_waiting_keys.select { |key| @pending_callbacks.key?(key) }
|
|
459
|
+
@newly_waiting_keys.clear
|
|
460
|
+
newly_waiting
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
enqueue_worker_status_for(keys)
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
def enqueue_worker_status_for_long_pending_waiters
|
|
467
|
+
registered_before = monotonic_now - WORKER_STATUS_RESEND_MIN_PENDING_SECONDS
|
|
468
|
+
|
|
469
|
+
keys = @mu.synchronize do
|
|
470
|
+
@waiting_since.select! { |key, _| @pending_callbacks.key?(key) }
|
|
471
|
+
@waiting_since.select { |_, waiting_since| waiting_since <= registered_before }.keys
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
enqueue_worker_status_for(keys)
|
|
475
|
+
end
|
|
441
476
|
|
|
442
|
-
|
|
443
|
-
|
|
477
|
+
def enqueue_full_worker_status
|
|
478
|
+
keys = @mu.synchronize do
|
|
479
|
+
@newly_waiting_keys.clear
|
|
480
|
+
@pending_callbacks.keys
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
enqueue_worker_status_for(keys)
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
def enqueue_worker_status_for(keys)
|
|
487
|
+
request_queue = @request_queue
|
|
488
|
+
return if request_queue.nil? || @worker_id.nil?
|
|
489
|
+
|
|
490
|
+
keys.each_slice(WORKER_STATUS_MAX_ENTRIES_PER_REQUEST) do |keys_for_request|
|
|
491
|
+
waiting = keys_for_request.map do |(task_ext_id, inv_count, branch_id, node_id)|
|
|
492
|
+
::V1::DurableTaskAwaitedCompletedEntry.new(
|
|
493
|
+
durable_task_external_id: task_ext_id,
|
|
494
|
+
invocation_count: inv_count,
|
|
495
|
+
node_id: node_id,
|
|
496
|
+
branch_id: branch_id,
|
|
497
|
+
)
|
|
498
|
+
end
|
|
444
499
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
branch_id: branch_id,
|
|
500
|
+
request_queue << ::V1::DurableTaskRequest.new(
|
|
501
|
+
worker_status: ::V1::DurableTaskWorkerStatusRequest.new(
|
|
502
|
+
worker_id: @worker_id,
|
|
503
|
+
waiting_entries: waiting,
|
|
504
|
+
),
|
|
451
505
|
)
|
|
452
506
|
end
|
|
507
|
+
end
|
|
453
508
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
worker_id: @worker_id,
|
|
457
|
-
waiting_entries: waiting,
|
|
458
|
-
),
|
|
459
|
-
)
|
|
509
|
+
def monotonic_now
|
|
510
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
460
511
|
end
|
|
461
512
|
|
|
462
513
|
def send_loop
|
|
463
514
|
while @running
|
|
464
|
-
sleep
|
|
515
|
+
sleep WORKER_STATUS_RESEND_INTERVAL_SECONDS
|
|
465
516
|
begin
|
|
466
|
-
|
|
517
|
+
enqueue_worker_status_for_long_pending_waiters
|
|
467
518
|
rescue StandardError => e
|
|
468
519
|
@logger&.error("durable event listener send_loop error: #{e.class}: #{e.message}")
|
|
469
520
|
end
|
data/sig/hatchet/concurrency.rbs
CHANGED
|
@@ -4,16 +4,26 @@ module Hatchet
|
|
|
4
4
|
CANCEL_NEWEST: Symbol
|
|
5
5
|
GROUP_ROUND_ROBIN: Symbol
|
|
6
6
|
QUEUE: Symbol
|
|
7
|
+
CANCEL_QUEUED_EXCEPT_NEWEST: Symbol
|
|
8
|
+
CANCEL_QUEUED_EXCEPT_OLDEST: Symbol
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module ConcurrencyProto
|
|
12
|
+
LIMIT_STRATEGY_MAP: Hash[Symbol, Symbol]
|
|
13
|
+
|
|
14
|
+
def self.split_max_runs: (Integer | String max_runs) -> [Integer, String?]
|
|
7
15
|
end
|
|
8
16
|
|
|
9
17
|
class ConcurrencyExpression
|
|
10
18
|
LIMIT_STRATEGY_MAP: Hash[Symbol, Symbol]
|
|
11
19
|
|
|
12
20
|
attr_reader expression: String
|
|
13
|
-
attr_reader max_runs: Integer
|
|
21
|
+
attr_reader max_runs: Integer | String
|
|
14
22
|
attr_reader limit_strategy: Symbol
|
|
23
|
+
attr_reader name: String?
|
|
24
|
+
attr_reader is_tenant_scoped: bool
|
|
15
25
|
|
|
16
|
-
def initialize: (expression: String, ?max_runs: Integer, ?limit_strategy: Symbol) -> void
|
|
26
|
+
def initialize: (expression: String, ?max_runs: Integer | String, ?limit_strategy: Symbol, ?name: String?, ?is_tenant_scoped: bool) -> void
|
|
17
27
|
def to_h: () -> Hash[Symbol, untyped]
|
|
18
28
|
def to_proto: () -> untyped
|
|
19
29
|
end
|
|
@@ -3,6 +3,9 @@ module Hatchet
|
|
|
3
3
|
class DurableEventListener
|
|
4
4
|
DEFAULT_RECONNECT_INTERVAL: Integer
|
|
5
5
|
EVICTION_ACK_TIMEOUT_SECONDS: Float
|
|
6
|
+
WORKER_STATUS_RESEND_INTERVAL_SECONDS: Float
|
|
7
|
+
WORKER_STATUS_RESEND_MIN_PENDING_SECONDS: Float
|
|
8
|
+
WORKER_STATUS_MAX_ENTRIES_PER_REQUEST: Integer
|
|
6
9
|
|
|
7
10
|
class WaitForEvent < Struct[untyped]
|
|
8
11
|
attr_accessor wait_for_conditions: untyped
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hatchet-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- gabriel ruttner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -217,7 +217,6 @@ files:
|
|
|
217
217
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/log_api.rb
|
|
218
218
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/metadata_api.rb
|
|
219
219
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/observability_api.rb
|
|
220
|
-
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/operator_api.rb
|
|
221
220
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/rate_limits_api.rb
|
|
222
221
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/slack_api.rb
|
|
223
222
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/sns_api.rb
|
|
@@ -378,7 +377,6 @@ files:
|
|
|
378
377
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cel_debug_response.rb
|
|
379
378
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cel_debug_response_status.rb
|
|
380
379
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_filter_request.rb
|
|
381
|
-
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_http_operator_request.rb
|
|
382
380
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request.rb
|
|
383
381
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_api_key.rb
|
|
384
382
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_base.rb
|
|
@@ -395,8 +393,6 @@ files:
|
|
|
395
393
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event_workflow_run_summary.rb
|
|
396
394
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_filter.rb
|
|
397
395
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_filter_list.rb
|
|
398
|
-
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator.rb
|
|
399
|
-
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator_list.rb
|
|
400
396
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line.rb
|
|
401
397
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line_level.rb
|
|
402
398
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line_list.rb
|
|
@@ -423,7 +419,6 @@ files:
|
|
|
423
419
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_timing_list.rb
|
|
424
420
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_trigger_workflow_run_request.rb
|
|
425
421
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_filter_request.rb
|
|
426
|
-
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_http_operator_request.rb
|
|
427
422
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_webhook_request.rb
|
|
428
423
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_wait_item.rb
|
|
429
424
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook.rb
|