hatchet-sdk 0.40.0a9__py3-none-any.whl → 0.42.0__py3-none-any.whl
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.
Potentially problematic release.
This version of hatchet-sdk might be problematic. Click here for more details.
- hatchet_sdk/clients/admin.py +129 -59
- hatchet_sdk/clients/dispatcher/action_listener.py +25 -2
- hatchet_sdk/clients/events.py +91 -52
- hatchet_sdk/clients/rest/__init__.py +21 -0
- hatchet_sdk/clients/rest/api/api_token_api.py +12 -9
- hatchet_sdk/clients/rest/api/default_api.py +24 -18
- hatchet_sdk/clients/rest/api/event_api.py +32 -24
- hatchet_sdk/clients/rest/api/github_api.py +4 -3
- hatchet_sdk/clients/rest/api/log_api.py +4 -3
- hatchet_sdk/clients/rest/api/metadata_api.py +12 -9
- hatchet_sdk/clients/rest/api/rate_limits_api.py +7 -4
- hatchet_sdk/clients/rest/api/slack_api.py +8 -6
- hatchet_sdk/clients/rest/api/sns_api.py +12 -9
- hatchet_sdk/clients/rest/api/step_run_api.py +28 -21
- hatchet_sdk/clients/rest/api/tenant_api.py +67 -49
- hatchet_sdk/clients/rest/api/user_api.py +24 -18
- hatchet_sdk/clients/rest/api/worker_api.py +12 -9
- hatchet_sdk/clients/rest/api/workflow_api.py +3073 -936
- hatchet_sdk/clients/rest/api/workflow_run_api.py +669 -21
- hatchet_sdk/clients/rest/api_client.py +34 -11
- hatchet_sdk/clients/rest/configuration.py +161 -36
- hatchet_sdk/clients/rest/models/__init__.py +21 -0
- hatchet_sdk/clients/rest/models/api_errors.py +3 -3
- hatchet_sdk/clients/rest/models/bulk_create_event_request.py +3 -3
- hatchet_sdk/clients/rest/models/bulk_create_event_response.py +3 -3
- hatchet_sdk/clients/{cloud_rest/models/managed_worker_create_request_build_config_steps_inner.py → rest/models/create_cron_workflow_trigger_request.py} +18 -14
- hatchet_sdk/clients/{cloud_rest/models/github_app_list_installations200_response_rows_inner.py → rest/models/cron_workflows.py} +54 -21
- hatchet_sdk/clients/{cloud_rest/models/log_list200_response.py → rest/models/cron_workflows_list.py} +13 -22
- hatchet_sdk/clients/rest/models/cron_workflows_order_by_field.py +37 -0
- hatchet_sdk/clients/rest/models/event_list.py +3 -3
- hatchet_sdk/clients/rest/models/get_step_run_diff_response.py +3 -3
- hatchet_sdk/clients/rest/models/job.py +3 -3
- hatchet_sdk/clients/rest/models/job_run.py +3 -3
- hatchet_sdk/clients/rest/models/list_api_tokens_response.py +3 -3
- hatchet_sdk/clients/rest/models/list_pull_requests_response.py +3 -3
- hatchet_sdk/clients/rest/models/list_slack_webhooks.py +3 -3
- hatchet_sdk/clients/rest/models/list_sns_integrations.py +3 -3
- hatchet_sdk/clients/rest/models/log_line_list.py +3 -3
- hatchet_sdk/clients/rest/models/rate_limit_list.py +3 -3
- hatchet_sdk/clients/rest/models/replay_workflow_runs_response.py +3 -3
- hatchet_sdk/clients/{cloud_rest/models/log_list200_response_rows_inner.py → rest/models/schedule_workflow_run_request.py} +12 -12
- hatchet_sdk/clients/rest/models/scheduled_run_status.py +42 -0
- hatchet_sdk/clients/rest/models/scheduled_workflows.py +153 -0
- hatchet_sdk/clients/{cloud_rest/models/managed_worker_list200_response.py → rest/models/scheduled_workflows_list.py} +13 -22
- hatchet_sdk/clients/rest/models/scheduled_workflows_order_by_field.py +37 -0
- hatchet_sdk/clients/rest/models/step_run_archive_list.py +3 -3
- hatchet_sdk/clients/rest/models/step_run_event_list.py +3 -3
- hatchet_sdk/clients/rest/models/tenant_alert_email_group_list.py +3 -3
- hatchet_sdk/clients/rest/models/tenant_invite_list.py +3 -3
- hatchet_sdk/clients/rest/models/tenant_list.py +3 -3
- hatchet_sdk/clients/rest/models/tenant_member_list.py +3 -3
- hatchet_sdk/clients/rest/models/tenant_queue_metrics.py +16 -0
- hatchet_sdk/clients/rest/models/tenant_resource_policy.py +3 -3
- hatchet_sdk/clients/rest/models/tenant_step_run_queue_metrics.py +1 -1
- hatchet_sdk/clients/rest/models/user_tenant_memberships_list.py +3 -3
- hatchet_sdk/clients/rest/models/webhook_worker_list_response.py +3 -3
- hatchet_sdk/clients/rest/models/webhook_worker_request_list_response.py +3 -3
- hatchet_sdk/clients/rest/models/worker.py +20 -9
- hatchet_sdk/clients/rest/models/worker_list.py +3 -3
- hatchet_sdk/clients/{cloud_rest/models/tenant_billing_state_get200_response_payment_methods_inner.py → rest/models/worker_runtime_info.py} +23 -19
- hatchet_sdk/clients/rest/models/worker_runtime_sdks.py +38 -0
- hatchet_sdk/clients/rest/models/workflow.py +9 -9
- hatchet_sdk/clients/rest/models/workflow_list.py +3 -3
- hatchet_sdk/clients/rest/models/workflow_run.py +3 -3
- hatchet_sdk/clients/rest/models/workflow_run_list.py +3 -3
- hatchet_sdk/clients/rest/models/workflow_run_shape.py +3 -3
- hatchet_sdk/clients/rest/models/workflow_runs_metrics.py +1 -5
- hatchet_sdk/clients/rest/models/workflow_triggers.py +6 -6
- hatchet_sdk/clients/rest/models/workflow_version.py +3 -3
- hatchet_sdk/clients/rest/rest.py +3 -3
- hatchet_sdk/clients/rest_client.py +200 -21
- hatchet_sdk/contracts/dispatcher_pb2.py +71 -67
- hatchet_sdk/contracts/dispatcher_pb2.pyi +31 -2
- hatchet_sdk/contracts/events_pb2.pyi +2 -0
- hatchet_sdk/contracts/workflows_pb2.py +42 -40
- hatchet_sdk/contracts/workflows_pb2.pyi +24 -6
- hatchet_sdk/features/cron.py +286 -0
- hatchet_sdk/features/scheduled.py +248 -0
- hatchet_sdk/hatchet.py +80 -79
- hatchet_sdk/loader.py +37 -14
- hatchet_sdk/utils/serialization.py +15 -0
- hatchet_sdk/utils/tracing.py +67 -0
- hatchet_sdk/worker/runner/runner.py +158 -112
- hatchet_sdk/worker/worker.py +1 -17
- hatchet_sdk/workflow.py +4 -0
- {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/METADATA +8 -2
- {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/RECORD +89 -143
- {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/entry_points.txt +1 -1
- hatchet_sdk/clients/cloud_rest/__init__.py +0 -186
- hatchet_sdk/clients/cloud_rest/api/__init__.py +0 -14
- hatchet_sdk/clients/cloud_rest/api/billing_api.py +0 -819
- hatchet_sdk/clients/cloud_rest/api/build_api.py +0 -298
- hatchet_sdk/clients/cloud_rest/api/feature_flags_api.py +0 -295
- hatchet_sdk/clients/cloud_rest/api/github_api.py +0 -1347
- hatchet_sdk/clients/cloud_rest/api/log_api.py +0 -971
- hatchet_sdk/clients/cloud_rest/api/managed_worker_api.py +0 -2546
- hatchet_sdk/clients/cloud_rest/api/metadata_api.py +0 -265
- hatchet_sdk/clients/cloud_rest/api/metrics_api.py +0 -1026
- hatchet_sdk/clients/cloud_rest/api/tenant_api.py +0 -301
- hatchet_sdk/clients/cloud_rest/api/user_api.py +0 -473
- hatchet_sdk/clients/cloud_rest/api/workflow_api.py +0 -369
- hatchet_sdk/clients/cloud_rest/api_client.py +0 -727
- hatchet_sdk/clients/cloud_rest/api_response.py +0 -22
- hatchet_sdk/clients/cloud_rest/configuration.py +0 -488
- hatchet_sdk/clients/cloud_rest/exceptions.py +0 -200
- hatchet_sdk/clients/cloud_rest/models/__init__.py +0 -157
- hatchet_sdk/clients/cloud_rest/models/billing_portal_link_get200_response.py +0 -85
- hatchet_sdk/clients/cloud_rest/models/build_get200_response.py +0 -121
- hatchet_sdk/clients/cloud_rest/models/github_app_list_branches200_response_inner.py +0 -86
- hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response.py +0 -119
- hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response_pagination.py +0 -95
- hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response_rows_inner_metadata.py +0 -98
- hatchet_sdk/clients/cloud_rest/models/github_app_list_repos200_response_inner.py +0 -86
- hatchet_sdk/clients/cloud_rest/models/infra_as_code_create_request.py +0 -107
- hatchet_sdk/clients/cloud_rest/models/log_create_request_inner.py +0 -136
- hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_event.py +0 -83
- hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_fly.py +0 -100
- hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_fly_app.py +0 -86
- hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_log.py +0 -83
- hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request.py +0 -128
- hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request_build_config.py +0 -121
- hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request_runtime_config.py +0 -166
- hatchet_sdk/clients/cloud_rest/models/managed_worker_events_list200_response.py +0 -119
- hatchet_sdk/clients/cloud_rest/models/managed_worker_events_list200_response_rows_inner.py +0 -117
- hatchet_sdk/clients/cloud_rest/models/managed_worker_instances_list200_response.py +0 -119
- hatchet_sdk/clients/cloud_rest/models/managed_worker_instances_list200_response_rows_inner.py +0 -113
- hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner.py +0 -154
- hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_build_config.py +0 -151
- hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_build_config_steps_inner.py +0 -109
- hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_runtime_configs_inner.py +0 -171
- hatchet_sdk/clients/cloud_rest/models/managed_worker_update_request.py +0 -131
- hatchet_sdk/clients/cloud_rest/models/metadata_get200_response.py +0 -101
- hatchet_sdk/clients/cloud_rest/models/metadata_get400_response.py +0 -105
- hatchet_sdk/clients/cloud_rest/models/metadata_get400_response_errors_inner.py +0 -102
- hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner.py +0 -108
- hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner.py +0 -102
- hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner_histogram.py +0 -113
- hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner_histogram_buckets_inner.py +0 -93
- hatchet_sdk/clients/cloud_rest/models/runtime_config_list_actions200_response.py +0 -83
- hatchet_sdk/clients/cloud_rest/models/subscription_upsert200_response.py +0 -114
- hatchet_sdk/clients/cloud_rest/models/subscription_upsert_request.py +0 -88
- hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response.py +0 -170
- hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_coupons_inner.py +0 -137
- hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_plans_inner.py +0 -103
- hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_subscription.py +0 -114
- hatchet_sdk/clients/cloud_rest/models/workflow_run_events_get_metrics200_response.py +0 -107
- hatchet_sdk/clients/cloud_rest/models/workflow_run_events_get_metrics200_response_results_inner.py +0 -105
- hatchet_sdk/clients/cloud_rest/rest.py +0 -182
- hatchet_sdk/compute/__init__.py +0 -0
- hatchet_sdk/compute/configs.py +0 -34
- hatchet_sdk/compute/managed_compute.py +0 -111
- {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/WHEEL +0 -0
|
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
|
|
|
15
15
|
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fworkflows.proto\x1a\x1fgoogle/protobuf/timestamp.proto\">\n\x12PutWorkflowRequest\x12(\n\x04opts\x18\x01 \x01(\x0b\x32\x1a.CreateWorkflowVersionOpts\"\xbf\x04\n\x19\x43reateWorkflowVersionOpts\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\x36\n\x12scheduled_triggers\x18\x06 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12$\n\x04jobs\x18\x07 \x03(\x0b\x32\x16.CreateWorkflowJobOpts\x12-\n\x0b\x63oncurrency\x18\x08 \x01(\x0b\x32\x18.WorkflowConcurrencyOpts\x12\x1d\n\x10schedule_timeout\x18\t \x01(\tH\x00\x88\x01\x01\x12\x17\n\ncron_input\x18\n \x01(\tH\x01\x88\x01\x01\x12\x33\n\x0eon_failure_job\x18\x0b \x01(\x0b\x32\x16.CreateWorkflowJobOptsH\x02\x88\x01\x01\x12$\n\x06sticky\x18\x0c \x01(\x0e\x32\x0f.StickyStrategyH\x03\x88\x01\x01\x12 \n\x04kind\x18\r \x01(\x0e\x32\r.WorkflowKindH\x04\x88\x01\x01\x12\x1d\n\x10\x64\x65\x66\x61ult_priority\x18\x0e \x01(\x05H\x05\x88\x01\x01\x42\x13\n\x11_schedule_timeoutB\r\n\x0b_cron_inputB\x11\n\x0f_on_failure_jobB\t\n\x07_stickyB\x07\n\x05_kindB\x13\n\x11_default_priority\"\xd0\x01\n\x17WorkflowConcurrencyOpts\x12\x13\n\x06\x61\x63tion\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08max_runs\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x36\n\x0elimit_strategy\x18\x03 \x01(\x0e\x32\x19.ConcurrencyLimitStrategyH\x02\x88\x01\x01\x12\x17\n\nexpression\x18\x04 \x01(\tH\x03\x88\x01\x01\x42\t\n\x07_actionB\x0b\n\t_max_runsB\x11\n\x0f_limit_strategyB\r\n\x0b_expression\"h\n\x15\x43reateWorkflowJobOpts\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12&\n\x05steps\x18\x04 \x03(\x0b\x32\x17.CreateWorkflowStepOptsJ\x04\x08\x03\x10\x04\"\xe1\x01\n\x13\x44\x65siredWorkerLabels\x12\x15\n\x08strValue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08intValue\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x15\n\x08required\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12/\n\ncomparator\x18\x04 \x01(\x0e\x32\x16.WorkerLabelComparatorH\x03\x88\x01\x01\x12\x13\n\x06weight\x18\x05 \x01(\x05H\x04\x88\x01\x01\x42\x0b\n\t_strValueB\x0b\n\t_intValueB\x0b\n\t_requiredB\r\n\x0b_comparatorB\t\n\x07_weight\"\
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fworkflows.proto\x1a\x1fgoogle/protobuf/timestamp.proto\">\n\x12PutWorkflowRequest\x12(\n\x04opts\x18\x01 \x01(\x0b\x32\x1a.CreateWorkflowVersionOpts\"\xbf\x04\n\x19\x43reateWorkflowVersionOpts\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\x36\n\x12scheduled_triggers\x18\x06 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12$\n\x04jobs\x18\x07 \x03(\x0b\x32\x16.CreateWorkflowJobOpts\x12-\n\x0b\x63oncurrency\x18\x08 \x01(\x0b\x32\x18.WorkflowConcurrencyOpts\x12\x1d\n\x10schedule_timeout\x18\t \x01(\tH\x00\x88\x01\x01\x12\x17\n\ncron_input\x18\n \x01(\tH\x01\x88\x01\x01\x12\x33\n\x0eon_failure_job\x18\x0b \x01(\x0b\x32\x16.CreateWorkflowJobOptsH\x02\x88\x01\x01\x12$\n\x06sticky\x18\x0c \x01(\x0e\x32\x0f.StickyStrategyH\x03\x88\x01\x01\x12 \n\x04kind\x18\r \x01(\x0e\x32\r.WorkflowKindH\x04\x88\x01\x01\x12\x1d\n\x10\x64\x65\x66\x61ult_priority\x18\x0e \x01(\x05H\x05\x88\x01\x01\x42\x13\n\x11_schedule_timeoutB\r\n\x0b_cron_inputB\x11\n\x0f_on_failure_jobB\t\n\x07_stickyB\x07\n\x05_kindB\x13\n\x11_default_priority\"\xd0\x01\n\x17WorkflowConcurrencyOpts\x12\x13\n\x06\x61\x63tion\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08max_runs\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x36\n\x0elimit_strategy\x18\x03 \x01(\x0e\x32\x19.ConcurrencyLimitStrategyH\x02\x88\x01\x01\x12\x17\n\nexpression\x18\x04 \x01(\tH\x03\x88\x01\x01\x42\t\n\x07_actionB\x0b\n\t_max_runsB\x11\n\x0f_limit_strategyB\r\n\x0b_expression\"h\n\x15\x43reateWorkflowJobOpts\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12&\n\x05steps\x18\x04 \x03(\x0b\x32\x17.CreateWorkflowStepOptsJ\x04\x08\x03\x10\x04\"\xe1\x01\n\x13\x44\x65siredWorkerLabels\x12\x15\n\x08strValue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08intValue\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x15\n\x08required\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12/\n\ncomparator\x18\x04 \x01(\x0e\x32\x16.WorkerLabelComparatorH\x03\x88\x01\x01\x12\x13\n\x06weight\x18\x05 \x01(\x05H\x04\x88\x01\x01\x42\x0b\n\t_strValueB\x0b\n\t_intValueB\x0b\n\t_requiredB\r\n\x0b_comparatorB\t\n\x07_weight\"\xb5\x03\n\x16\x43reateWorkflowStepOpts\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\x11\n\tuser_data\x18\x06 \x01(\t\x12\x0f\n\x07retries\x18\x07 \x01(\x05\x12)\n\x0brate_limits\x18\x08 \x03(\x0b\x32\x14.CreateStepRateLimit\x12@\n\rworker_labels\x18\t \x03(\x0b\x32).CreateWorkflowStepOpts.WorkerLabelsEntry\x12\x1b\n\x0e\x62\x61\x63koff_factor\x18\n \x01(\x02H\x00\x88\x01\x01\x12 \n\x13\x62\x61\x63koff_max_seconds\x18\x0b \x01(\x05H\x01\x88\x01\x01\x1aI\n\x11WorkerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.DesiredWorkerLabels:\x02\x38\x01\x42\x11\n\x0f_backoff_factorB\x16\n\x14_backoff_max_seconds\"\xfa\x01\n\x13\x43reateStepRateLimit\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\x12.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\"\x16\n\x14ListWorkflowsRequest\"\xcd\x02\n\x17ScheduleWorkflowRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12-\n\tschedules\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05input\x18\x03 \x01(\t\x12\x16\n\tparent_id\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12parent_step_run_id\x18\x05 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x63hild_index\x18\x06 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tchild_key\x18\x07 \x01(\tH\x03\x88\x01\x01\x12 \n\x13\x61\x64\x64itional_metadata\x18\x08 \x01(\tH\x04\x88\x01\x01\x42\x0c\n\n_parent_idB\x15\n\x13_parent_step_run_idB\x0e\n\x0c_child_indexB\x0c\n\n_child_keyB\x16\n\x14_additional_metadata\"O\n\x11ScheduledWorkflow\x12\n\n\x02id\x18\x01 \x01(\t\x12.\n\ntrigger_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xe3\x01\n\x0fWorkflowVersion\x12\n\n\x02id\x18\x01 \x01(\t\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07version\x18\x05 \x01(\t\x12\r\n\x05order\x18\x06 \x01(\x03\x12\x13\n\x0bworkflow_id\x18\x07 \x01(\t\x12/\n\x13scheduled_workflows\x18\x08 \x03(\x0b\x32\x12.ScheduledWorkflow\"?\n\x17WorkflowTriggerEventRef\x12\x11\n\tparent_id\x18\x01 \x01(\t\x12\x11\n\tevent_key\x18\x02 \x01(\t\"9\n\x16WorkflowTriggerCronRef\x12\x11\n\tparent_id\x18\x01 \x01(\t\x12\x0c\n\x04\x63ron\x18\x02 \x01(\t\"H\n\x1a\x42ulkTriggerWorkflowRequest\x12*\n\tworkflows\x18\x01 \x03(\x0b\x32\x17.TriggerWorkflowRequest\"7\n\x1b\x42ulkTriggerWorkflowResponse\x12\x18\n\x10workflow_run_ids\x18\x01 \x03(\t\"\xf7\x02\n\x16TriggerWorkflowRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\t\x12\x16\n\tparent_id\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12parent_step_run_id\x18\x04 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x63hild_index\x18\x05 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tchild_key\x18\x06 \x01(\tH\x03\x88\x01\x01\x12 \n\x13\x61\x64\x64itional_metadata\x18\x07 \x01(\tH\x04\x88\x01\x01\x12\x1e\n\x11\x64\x65sired_worker_id\x18\x08 \x01(\tH\x05\x88\x01\x01\x12\x15\n\x08priority\x18\t \x01(\x05H\x06\x88\x01\x01\x42\x0c\n\n_parent_idB\x15\n\x13_parent_step_run_idB\x0e\n\x0c_child_indexB\x0c\n\n_child_keyB\x16\n\x14_additional_metadataB\x14\n\x12_desired_worker_idB\x0b\n\t_priority\"2\n\x17TriggerWorkflowResponse\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\"W\n\x13PutRateLimitRequest\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05limit\x18\x02 \x01(\x05\x12$\n\x08\x64uration\x18\x03 \x01(\x0e\x32\x12.RateLimitDuration\"\x16\n\x14PutRateLimitResponse*$\n\x0eStickyStrategy\x12\x08\n\x04SOFT\x10\x00\x12\x08\n\x04HARD\x10\x01*2\n\x0cWorkflowKind\x12\x0c\n\x08\x46UNCTION\x10\x00\x12\x0b\n\x07\x44URABLE\x10\x01\x12\x07\n\x03\x44\x41G\x10\x02*l\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*\x85\x01\n\x15WorkerLabelComparator\x12\t\n\x05\x45QUAL\x10\x00\x12\r\n\tNOT_EQUAL\x10\x01\x12\x10\n\x0cGREATER_THAN\x10\x02\x12\x19\n\x15GREATER_THAN_OR_EQUAL\x10\x03\x12\r\n\tLESS_THAN\x10\x04\x12\x16\n\x12LESS_THAN_OR_EQUAL\x10\x05*]\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\x32\xdc\x02\n\x0fWorkflowService\x12\x34\n\x0bPutWorkflow\x12\x13.PutWorkflowRequest\x1a\x10.WorkflowVersion\x12>\n\x10ScheduleWorkflow\x12\x18.ScheduleWorkflowRequest\x1a\x10.WorkflowVersion\x12\x44\n\x0fTriggerWorkflow\x12\x17.TriggerWorkflowRequest\x1a\x18.TriggerWorkflowResponse\x12P\n\x13\x42ulkTriggerWorkflow\x12\x1b.BulkTriggerWorkflowRequest\x1a\x1c.BulkTriggerWorkflowResponse\x12;\n\x0cPutRateLimit\x12\x14.PutRateLimitRequest\x1a\x15.PutRateLimitResponseBBZ@github.com/hatchet-dev/hatchet/internal/services/admin/contractsb\x06proto3')
|
|
19
19
|
|
|
20
20
|
_globals = globals()
|
|
21
21
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -25,16 +25,16 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
|
|
25
25
|
_globals['DESCRIPTOR']._serialized_options = b'Z@github.com/hatchet-dev/hatchet/internal/services/admin/contracts'
|
|
26
26
|
_globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._options = None
|
|
27
27
|
_globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_options = b'8\001'
|
|
28
|
-
_globals['_STICKYSTRATEGY']._serialized_start=
|
|
29
|
-
_globals['_STICKYSTRATEGY']._serialized_end=
|
|
30
|
-
_globals['_WORKFLOWKIND']._serialized_start=
|
|
31
|
-
_globals['_WORKFLOWKIND']._serialized_end=
|
|
32
|
-
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_start=
|
|
33
|
-
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_end=
|
|
34
|
-
_globals['_WORKERLABELCOMPARATOR']._serialized_start=
|
|
35
|
-
_globals['_WORKERLABELCOMPARATOR']._serialized_end=
|
|
36
|
-
_globals['_RATELIMITDURATION']._serialized_start=
|
|
37
|
-
_globals['_RATELIMITDURATION']._serialized_end=
|
|
28
|
+
_globals['_STICKYSTRATEGY']._serialized_start=3401
|
|
29
|
+
_globals['_STICKYSTRATEGY']._serialized_end=3437
|
|
30
|
+
_globals['_WORKFLOWKIND']._serialized_start=3439
|
|
31
|
+
_globals['_WORKFLOWKIND']._serialized_end=3489
|
|
32
|
+
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_start=3491
|
|
33
|
+
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_end=3599
|
|
34
|
+
_globals['_WORKERLABELCOMPARATOR']._serialized_start=3602
|
|
35
|
+
_globals['_WORKERLABELCOMPARATOR']._serialized_end=3735
|
|
36
|
+
_globals['_RATELIMITDURATION']._serialized_start=3737
|
|
37
|
+
_globals['_RATELIMITDURATION']._serialized_end=3830
|
|
38
38
|
_globals['_PUTWORKFLOWREQUEST']._serialized_start=52
|
|
39
39
|
_globals['_PUTWORKFLOWREQUEST']._serialized_end=114
|
|
40
40
|
_globals['_CREATEWORKFLOWVERSIONOPTS']._serialized_start=117
|
|
@@ -46,33 +46,35 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
|
|
46
46
|
_globals['_DESIREDWORKERLABELS']._serialized_start=1012
|
|
47
47
|
_globals['_DESIREDWORKERLABELS']._serialized_end=1237
|
|
48
48
|
_globals['_CREATEWORKFLOWSTEPOPTS']._serialized_start=1240
|
|
49
|
-
_globals['_CREATEWORKFLOWSTEPOPTS']._serialized_end=
|
|
50
|
-
_globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_start=
|
|
51
|
-
_globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_end=
|
|
52
|
-
_globals['_CREATESTEPRATELIMIT']._serialized_start=
|
|
53
|
-
_globals['_CREATESTEPRATELIMIT']._serialized_end=
|
|
54
|
-
_globals['_LISTWORKFLOWSREQUEST']._serialized_start=
|
|
55
|
-
_globals['_LISTWORKFLOWSREQUEST']._serialized_end=
|
|
56
|
-
_globals['_SCHEDULEWORKFLOWREQUEST']._serialized_start=
|
|
57
|
-
_globals['_SCHEDULEWORKFLOWREQUEST']._serialized_end=
|
|
58
|
-
_globals['
|
|
59
|
-
_globals['
|
|
60
|
-
_globals['
|
|
61
|
-
_globals['
|
|
62
|
-
_globals['
|
|
63
|
-
_globals['
|
|
64
|
-
_globals['
|
|
65
|
-
_globals['
|
|
66
|
-
_globals['
|
|
67
|
-
_globals['
|
|
68
|
-
_globals['
|
|
69
|
-
_globals['
|
|
70
|
-
_globals['
|
|
71
|
-
_globals['
|
|
72
|
-
_globals['
|
|
73
|
-
_globals['
|
|
74
|
-
_globals['
|
|
75
|
-
_globals['
|
|
76
|
-
_globals['
|
|
77
|
-
_globals['
|
|
49
|
+
_globals['_CREATEWORKFLOWSTEPOPTS']._serialized_end=1677
|
|
50
|
+
_globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_start=1561
|
|
51
|
+
_globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_end=1634
|
|
52
|
+
_globals['_CREATESTEPRATELIMIT']._serialized_start=1680
|
|
53
|
+
_globals['_CREATESTEPRATELIMIT']._serialized_end=1930
|
|
54
|
+
_globals['_LISTWORKFLOWSREQUEST']._serialized_start=1932
|
|
55
|
+
_globals['_LISTWORKFLOWSREQUEST']._serialized_end=1954
|
|
56
|
+
_globals['_SCHEDULEWORKFLOWREQUEST']._serialized_start=1957
|
|
57
|
+
_globals['_SCHEDULEWORKFLOWREQUEST']._serialized_end=2290
|
|
58
|
+
_globals['_SCHEDULEDWORKFLOW']._serialized_start=2292
|
|
59
|
+
_globals['_SCHEDULEDWORKFLOW']._serialized_end=2371
|
|
60
|
+
_globals['_WORKFLOWVERSION']._serialized_start=2374
|
|
61
|
+
_globals['_WORKFLOWVERSION']._serialized_end=2601
|
|
62
|
+
_globals['_WORKFLOWTRIGGEREVENTREF']._serialized_start=2603
|
|
63
|
+
_globals['_WORKFLOWTRIGGEREVENTREF']._serialized_end=2666
|
|
64
|
+
_globals['_WORKFLOWTRIGGERCRONREF']._serialized_start=2668
|
|
65
|
+
_globals['_WORKFLOWTRIGGERCRONREF']._serialized_end=2725
|
|
66
|
+
_globals['_BULKTRIGGERWORKFLOWREQUEST']._serialized_start=2727
|
|
67
|
+
_globals['_BULKTRIGGERWORKFLOWREQUEST']._serialized_end=2799
|
|
68
|
+
_globals['_BULKTRIGGERWORKFLOWRESPONSE']._serialized_start=2801
|
|
69
|
+
_globals['_BULKTRIGGERWORKFLOWRESPONSE']._serialized_end=2856
|
|
70
|
+
_globals['_TRIGGERWORKFLOWREQUEST']._serialized_start=2859
|
|
71
|
+
_globals['_TRIGGERWORKFLOWREQUEST']._serialized_end=3234
|
|
72
|
+
_globals['_TRIGGERWORKFLOWRESPONSE']._serialized_start=3236
|
|
73
|
+
_globals['_TRIGGERWORKFLOWRESPONSE']._serialized_end=3286
|
|
74
|
+
_globals['_PUTRATELIMITREQUEST']._serialized_start=3288
|
|
75
|
+
_globals['_PUTRATELIMITREQUEST']._serialized_end=3375
|
|
76
|
+
_globals['_PUTRATELIMITRESPONSE']._serialized_start=3377
|
|
77
|
+
_globals['_PUTRATELIMITRESPONSE']._serialized_end=3399
|
|
78
|
+
_globals['_WORKFLOWSERVICE']._serialized_start=3833
|
|
79
|
+
_globals['_WORKFLOWSERVICE']._serialized_end=4181
|
|
78
80
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
|
|
1
3
|
from google.protobuf import timestamp_pb2 as _timestamp_pb2
|
|
2
4
|
from google.protobuf.internal import containers as _containers
|
|
3
5
|
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
@@ -141,7 +143,7 @@ class DesiredWorkerLabels(_message.Message):
|
|
|
141
143
|
def __init__(self, strValue: _Optional[str] = ..., intValue: _Optional[int] = ..., required: bool = ..., comparator: _Optional[_Union[WorkerLabelComparator, str]] = ..., weight: _Optional[int] = ...) -> None: ...
|
|
142
144
|
|
|
143
145
|
class CreateWorkflowStepOpts(_message.Message):
|
|
144
|
-
__slots__ = ("readable_id", "action", "timeout", "inputs", "parents", "user_data", "retries", "rate_limits", "worker_labels")
|
|
146
|
+
__slots__ = ("readable_id", "action", "timeout", "inputs", "parents", "user_data", "retries", "rate_limits", "worker_labels", "backoff_factor", "backoff_max_seconds")
|
|
145
147
|
class WorkerLabelsEntry(_message.Message):
|
|
146
148
|
__slots__ = ("key", "value")
|
|
147
149
|
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -158,6 +160,8 @@ class CreateWorkflowStepOpts(_message.Message):
|
|
|
158
160
|
RETRIES_FIELD_NUMBER: _ClassVar[int]
|
|
159
161
|
RATE_LIMITS_FIELD_NUMBER: _ClassVar[int]
|
|
160
162
|
WORKER_LABELS_FIELD_NUMBER: _ClassVar[int]
|
|
163
|
+
BACKOFF_FACTOR_FIELD_NUMBER: _ClassVar[int]
|
|
164
|
+
BACKOFF_MAX_SECONDS_FIELD_NUMBER: _ClassVar[int]
|
|
161
165
|
readable_id: str
|
|
162
166
|
action: str
|
|
163
167
|
timeout: str
|
|
@@ -167,7 +171,9 @@ class CreateWorkflowStepOpts(_message.Message):
|
|
|
167
171
|
retries: int
|
|
168
172
|
rate_limits: _containers.RepeatedCompositeFieldContainer[CreateStepRateLimit]
|
|
169
173
|
worker_labels: _containers.MessageMap[str, DesiredWorkerLabels]
|
|
170
|
-
|
|
174
|
+
backoff_factor: float
|
|
175
|
+
backoff_max_seconds: int
|
|
176
|
+
def __init__(self, readable_id: _Optional[str] = ..., action: _Optional[str] = ..., timeout: _Optional[str] = ..., inputs: _Optional[str] = ..., parents: _Optional[_Iterable[str]] = ..., user_data: _Optional[str] = ..., retries: _Optional[int] = ..., rate_limits: _Optional[_Iterable[_Union[CreateStepRateLimit, _Mapping]]] = ..., worker_labels: _Optional[_Mapping[str, DesiredWorkerLabels]] = ..., backoff_factor: _Optional[float] = ..., backoff_max_seconds: _Optional[int] = ...) -> None: ...
|
|
171
177
|
|
|
172
178
|
class CreateStepRateLimit(_message.Message):
|
|
173
179
|
__slots__ = ("key", "units", "key_expr", "units_expr", "limit_values_expr", "duration")
|
|
@@ -190,7 +196,7 @@ class ListWorkflowsRequest(_message.Message):
|
|
|
190
196
|
def __init__(self) -> None: ...
|
|
191
197
|
|
|
192
198
|
class ScheduleWorkflowRequest(_message.Message):
|
|
193
|
-
__slots__ = ("name", "schedules", "input", "parent_id", "parent_step_run_id", "child_index", "child_key")
|
|
199
|
+
__slots__ = ("name", "schedules", "input", "parent_id", "parent_step_run_id", "child_index", "child_key", "additional_metadata")
|
|
194
200
|
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
195
201
|
SCHEDULES_FIELD_NUMBER: _ClassVar[int]
|
|
196
202
|
INPUT_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -198,6 +204,7 @@ class ScheduleWorkflowRequest(_message.Message):
|
|
|
198
204
|
PARENT_STEP_RUN_ID_FIELD_NUMBER: _ClassVar[int]
|
|
199
205
|
CHILD_INDEX_FIELD_NUMBER: _ClassVar[int]
|
|
200
206
|
CHILD_KEY_FIELD_NUMBER: _ClassVar[int]
|
|
207
|
+
ADDITIONAL_METADATA_FIELD_NUMBER: _ClassVar[int]
|
|
201
208
|
name: str
|
|
202
209
|
schedules: _containers.RepeatedCompositeFieldContainer[_timestamp_pb2.Timestamp]
|
|
203
210
|
input: str
|
|
@@ -205,23 +212,34 @@ class ScheduleWorkflowRequest(_message.Message):
|
|
|
205
212
|
parent_step_run_id: str
|
|
206
213
|
child_index: int
|
|
207
214
|
child_key: str
|
|
208
|
-
|
|
215
|
+
additional_metadata: str
|
|
216
|
+
def __init__(self, name: _Optional[str] = ..., schedules: _Optional[_Iterable[_Union[_timestamp_pb2.Timestamp, _Mapping]]] = ..., input: _Optional[str] = ..., parent_id: _Optional[str] = ..., parent_step_run_id: _Optional[str] = ..., child_index: _Optional[int] = ..., child_key: _Optional[str] = ..., additional_metadata: _Optional[str] = ...) -> None: ...
|
|
217
|
+
|
|
218
|
+
class ScheduledWorkflow(_message.Message):
|
|
219
|
+
__slots__ = ("id", "trigger_at")
|
|
220
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
221
|
+
TRIGGER_AT_FIELD_NUMBER: _ClassVar[int]
|
|
222
|
+
id: str
|
|
223
|
+
trigger_at: _timestamp_pb2.Timestamp
|
|
224
|
+
def __init__(self, id: _Optional[str] = ..., trigger_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ...
|
|
209
225
|
|
|
210
226
|
class WorkflowVersion(_message.Message):
|
|
211
|
-
__slots__ = ("id", "created_at", "updated_at", "version", "order", "workflow_id")
|
|
227
|
+
__slots__ = ("id", "created_at", "updated_at", "version", "order", "workflow_id", "scheduled_workflows")
|
|
212
228
|
ID_FIELD_NUMBER: _ClassVar[int]
|
|
213
229
|
CREATED_AT_FIELD_NUMBER: _ClassVar[int]
|
|
214
230
|
UPDATED_AT_FIELD_NUMBER: _ClassVar[int]
|
|
215
231
|
VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
216
232
|
ORDER_FIELD_NUMBER: _ClassVar[int]
|
|
217
233
|
WORKFLOW_ID_FIELD_NUMBER: _ClassVar[int]
|
|
234
|
+
SCHEDULED_WORKFLOWS_FIELD_NUMBER: _ClassVar[int]
|
|
218
235
|
id: str
|
|
219
236
|
created_at: _timestamp_pb2.Timestamp
|
|
220
237
|
updated_at: _timestamp_pb2.Timestamp
|
|
221
238
|
version: str
|
|
222
239
|
order: int
|
|
223
240
|
workflow_id: str
|
|
224
|
-
|
|
241
|
+
scheduled_workflows: _containers.RepeatedCompositeFieldContainer[ScheduledWorkflow]
|
|
242
|
+
def __init__(self, id: _Optional[str] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., version: _Optional[str] = ..., order: _Optional[int] = ..., workflow_id: _Optional[str] = ..., scheduled_workflows: _Optional[_Iterable[_Union[ScheduledWorkflow, _Mapping]]] = ...) -> None: ...
|
|
225
243
|
|
|
226
244
|
class WorkflowTriggerEventRef(_message.Message):
|
|
227
245
|
__slots__ = ("parent_id", "event_key")
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, field_validator
|
|
4
|
+
|
|
5
|
+
from hatchet_sdk.client import Client
|
|
6
|
+
from hatchet_sdk.clients.rest.models.cron_workflows import CronWorkflows
|
|
7
|
+
from hatchet_sdk.clients.rest.models.cron_workflows_list import CronWorkflowsList
|
|
8
|
+
from hatchet_sdk.clients.rest.models.cron_workflows_order_by_field import (
|
|
9
|
+
CronWorkflowsOrderByField,
|
|
10
|
+
)
|
|
11
|
+
from hatchet_sdk.clients.rest.models.workflow_run_order_by_direction import (
|
|
12
|
+
WorkflowRunOrderByDirection,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CreateCronTriggerInput(BaseModel):
|
|
17
|
+
"""
|
|
18
|
+
Schema for creating a workflow run triggered by a cron.
|
|
19
|
+
|
|
20
|
+
Attributes:
|
|
21
|
+
expression (str): The cron expression defining the schedule.
|
|
22
|
+
input (dict): The input data for the cron workflow.
|
|
23
|
+
additional_metadata (dict[str, str]): Additional metadata associated with the cron trigger (e.g. {"key1": "value1", "key2": "value2"}).
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
expression: str = None
|
|
27
|
+
input: dict = {}
|
|
28
|
+
additional_metadata: dict[str, str] = {}
|
|
29
|
+
|
|
30
|
+
@field_validator("expression")
|
|
31
|
+
def validate_cron_expression(cls, v):
|
|
32
|
+
"""
|
|
33
|
+
Validates the cron expression to ensure it adheres to the expected format.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
v (str): The cron expression to validate.
|
|
37
|
+
|
|
38
|
+
Raises:
|
|
39
|
+
ValueError: If the expression is invalid.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
str: The validated cron expression.
|
|
43
|
+
"""
|
|
44
|
+
if not v:
|
|
45
|
+
raise ValueError("Cron expression is required")
|
|
46
|
+
|
|
47
|
+
parts = v.split()
|
|
48
|
+
if len(parts) != 5:
|
|
49
|
+
raise ValueError(
|
|
50
|
+
"Cron expression must have 5 parts: minute hour day month weekday"
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
for part in parts:
|
|
54
|
+
if not (
|
|
55
|
+
part == "*"
|
|
56
|
+
or part.replace("*/", "").replace("-", "").replace(",", "").isdigit()
|
|
57
|
+
):
|
|
58
|
+
raise ValueError(f"Invalid cron expression part: {part}")
|
|
59
|
+
|
|
60
|
+
return v
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class CronClient:
|
|
64
|
+
"""
|
|
65
|
+
Client for managing workflow cron triggers synchronously.
|
|
66
|
+
|
|
67
|
+
Attributes:
|
|
68
|
+
_client (Client): The underlying client used to interact with the REST API.
|
|
69
|
+
aio (CronClientAsync): Asynchronous counterpart of CronClient.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
_client: Client
|
|
73
|
+
|
|
74
|
+
def __init__(self, _client: Client):
|
|
75
|
+
"""
|
|
76
|
+
Initializes the CronClient with a given Client instance.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
_client (Client): The client instance to be used for REST interactions.
|
|
80
|
+
"""
|
|
81
|
+
self._client = _client
|
|
82
|
+
self.aio = CronClientAsync(_client)
|
|
83
|
+
|
|
84
|
+
def create(
|
|
85
|
+
self,
|
|
86
|
+
workflow_name: str,
|
|
87
|
+
cron_name: str,
|
|
88
|
+
expression: str,
|
|
89
|
+
input: dict,
|
|
90
|
+
additional_metadata: dict[str, str],
|
|
91
|
+
) -> CronWorkflows:
|
|
92
|
+
"""
|
|
93
|
+
Creates a new workflow cron trigger.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
workflow_name (str): The name of the workflow to trigger.
|
|
97
|
+
cron_name (str): The name of the cron trigger.
|
|
98
|
+
expression (str): The cron expression defining the schedule.
|
|
99
|
+
input (dict): The input data for the cron workflow.
|
|
100
|
+
additional_metadata (dict[str, str]): Additional metadata associated with the cron trigger (e.g. {"key1": "value1", "key2": "value2"}).
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
CronWorkflows: The created cron workflow instance.
|
|
104
|
+
"""
|
|
105
|
+
validated_input = CreateCronTriggerInput(
|
|
106
|
+
expression=expression, input=input, additional_metadata=additional_metadata
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return self._client.rest.cron_create(
|
|
110
|
+
workflow_name,
|
|
111
|
+
cron_name,
|
|
112
|
+
validated_input.expression,
|
|
113
|
+
validated_input.input,
|
|
114
|
+
validated_input.additional_metadata,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
def delete(self, cron_trigger: Union[str, CronWorkflows]) -> None:
|
|
118
|
+
"""
|
|
119
|
+
Deletes a workflow cron trigger.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
cron_trigger (Union[str, CronWorkflows]): The cron trigger ID or CronWorkflows instance to delete.
|
|
123
|
+
"""
|
|
124
|
+
id_ = cron_trigger
|
|
125
|
+
if isinstance(cron_trigger, CronWorkflows):
|
|
126
|
+
id_ = cron_trigger.metadata.id
|
|
127
|
+
self._client.rest.cron_delete(id_)
|
|
128
|
+
|
|
129
|
+
def list(
|
|
130
|
+
self,
|
|
131
|
+
offset: int | None = None,
|
|
132
|
+
limit: int | None = None,
|
|
133
|
+
workflow_id: str | None = None,
|
|
134
|
+
additional_metadata: list[str] | None = None,
|
|
135
|
+
order_by_field: CronWorkflowsOrderByField | None = None,
|
|
136
|
+
order_by_direction: WorkflowRunOrderByDirection | None = None,
|
|
137
|
+
) -> CronWorkflowsList:
|
|
138
|
+
"""
|
|
139
|
+
Retrieves a list of all workflow cron triggers matching the criteria.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
offset (int | None): The offset to start the list from.
|
|
143
|
+
limit (int | None): The maximum number of items to return.
|
|
144
|
+
workflow_id (str | None): The ID of the workflow to filter by.
|
|
145
|
+
additional_metadata (list[str] | None): Filter by additional metadata keys (e.g. ["key1:value1", "key2:value2"]).
|
|
146
|
+
order_by_field (CronWorkflowsOrderByField | None): The field to order the list by.
|
|
147
|
+
order_by_direction (WorkflowRunOrderByDirection | None): The direction to order the list by.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
CronWorkflowsList: A list of cron workflows.
|
|
151
|
+
"""
|
|
152
|
+
return self._client.rest.cron_list(
|
|
153
|
+
offset=offset,
|
|
154
|
+
limit=limit,
|
|
155
|
+
workflow_id=workflow_id,
|
|
156
|
+
additional_metadata=additional_metadata,
|
|
157
|
+
order_by_field=order_by_field,
|
|
158
|
+
order_by_direction=order_by_direction,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
def get(self, cron_trigger: Union[str, CronWorkflows]) -> CronWorkflows:
|
|
162
|
+
"""
|
|
163
|
+
Retrieves a specific workflow cron trigger by ID.
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
cron_trigger (Union[str, CronWorkflows]): The cron trigger ID or CronWorkflows instance to retrieve.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
CronWorkflows: The requested cron workflow instance.
|
|
170
|
+
"""
|
|
171
|
+
id_ = cron_trigger
|
|
172
|
+
if isinstance(cron_trigger, CronWorkflows):
|
|
173
|
+
id_ = cron_trigger.metadata.id
|
|
174
|
+
return self._client.rest.cron_get(id_)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class CronClientAsync:
|
|
178
|
+
"""
|
|
179
|
+
Asynchronous client for managing workflow cron triggers.
|
|
180
|
+
|
|
181
|
+
Attributes:
|
|
182
|
+
_client (Client): The underlying client used to interact with the REST API asynchronously.
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
_client: Client
|
|
186
|
+
|
|
187
|
+
def __init__(self, _client: Client):
|
|
188
|
+
"""
|
|
189
|
+
Initializes the CronClientAsync with a given Client instance.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
_client (Client): The client instance to be used for asynchronous REST interactions.
|
|
193
|
+
"""
|
|
194
|
+
self._client = _client
|
|
195
|
+
|
|
196
|
+
async def create(
|
|
197
|
+
self,
|
|
198
|
+
workflow_name: str,
|
|
199
|
+
cron_name: str,
|
|
200
|
+
expression: str,
|
|
201
|
+
input: dict,
|
|
202
|
+
additional_metadata: dict[str, str],
|
|
203
|
+
) -> CronWorkflows:
|
|
204
|
+
"""
|
|
205
|
+
Asynchronously creates a new workflow cron trigger.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
workflow_name (str): The name of the workflow to trigger.
|
|
209
|
+
cron_name (str): The name of the cron trigger.
|
|
210
|
+
expression (str): The cron expression defining the schedule.
|
|
211
|
+
input (dict): The input data for the cron workflow.
|
|
212
|
+
additional_metadata (dict[str, str]): Additional metadata associated with the cron trigger (e.g. {"key1": "value1", "key2": "value2"}).
|
|
213
|
+
|
|
214
|
+
Returns:
|
|
215
|
+
CronWorkflows: The created cron workflow instance.
|
|
216
|
+
"""
|
|
217
|
+
validated_input = CreateCronTriggerInput(
|
|
218
|
+
expression=expression, input=input, additional_metadata=additional_metadata
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
return await self._client.rest.aio.cron_create(
|
|
222
|
+
workflow_name=workflow_name,
|
|
223
|
+
cron_name=cron_name,
|
|
224
|
+
expression=validated_input.expression,
|
|
225
|
+
input=validated_input.input,
|
|
226
|
+
additional_metadata=validated_input.additional_metadata,
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
async def delete(self, cron_trigger: Union[str, CronWorkflows]) -> None:
|
|
230
|
+
"""
|
|
231
|
+
Asynchronously deletes a workflow cron trigger.
|
|
232
|
+
|
|
233
|
+
Args:
|
|
234
|
+
cron_trigger (Union[str, CronWorkflows]): The cron trigger ID or CronWorkflows instance to delete.
|
|
235
|
+
"""
|
|
236
|
+
id_ = cron_trigger
|
|
237
|
+
if isinstance(cron_trigger, CronWorkflows):
|
|
238
|
+
id_ = cron_trigger.metadata.id
|
|
239
|
+
await self._client.rest.aio.cron_delete(id_)
|
|
240
|
+
|
|
241
|
+
async def list(
|
|
242
|
+
self,
|
|
243
|
+
offset: int | None = None,
|
|
244
|
+
limit: int | None = None,
|
|
245
|
+
workflow_id: str | None = None,
|
|
246
|
+
additional_metadata: list[str] | None = None,
|
|
247
|
+
order_by_field: CronWorkflowsOrderByField | None = None,
|
|
248
|
+
order_by_direction: WorkflowRunOrderByDirection | None = None,
|
|
249
|
+
) -> CronWorkflowsList:
|
|
250
|
+
"""
|
|
251
|
+
Asynchronously retrieves a list of all workflow cron triggers matching the criteria.
|
|
252
|
+
|
|
253
|
+
Args:
|
|
254
|
+
offset (int | None): The offset to start the list from.
|
|
255
|
+
limit (int | None): The maximum number of items to return.
|
|
256
|
+
workflow_id (str | None): The ID of the workflow to filter by.
|
|
257
|
+
additional_metadata (list[str] | None): Filter by additional metadata keys (e.g. ["key1:value1", "key2:value2"]).
|
|
258
|
+
order_by_field (CronWorkflowsOrderByField | None): The field to order the list by.
|
|
259
|
+
order_by_direction (WorkflowRunOrderByDirection | None): The direction to order the list by.
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
CronWorkflowsList: A list of cron workflows.
|
|
263
|
+
"""
|
|
264
|
+
return await self._client.rest.aio.cron_list(
|
|
265
|
+
offset=offset,
|
|
266
|
+
limit=limit,
|
|
267
|
+
workflow_id=workflow_id,
|
|
268
|
+
additional_metadata=additional_metadata,
|
|
269
|
+
order_by_field=order_by_field,
|
|
270
|
+
order_by_direction=order_by_direction,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
async def get(self, cron_trigger: Union[str, CronWorkflows]) -> CronWorkflows:
|
|
274
|
+
"""
|
|
275
|
+
Asynchronously retrieves a specific workflow cron trigger by ID.
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
cron_trigger (Union[str, CronWorkflows]): The cron trigger ID or CronWorkflows instance to retrieve.
|
|
279
|
+
|
|
280
|
+
Returns:
|
|
281
|
+
CronWorkflows: The requested cron workflow instance.
|
|
282
|
+
"""
|
|
283
|
+
id_ = cron_trigger
|
|
284
|
+
if isinstance(cron_trigger, CronWorkflows):
|
|
285
|
+
id_ = cron_trigger.metadata.id
|
|
286
|
+
return await self._client.rest.aio.cron_get(id_)
|