hatchet-sdk 0.47.1__py3-none-any.whl → 1.0.0a1__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/__init__.py +45 -25
- hatchet_sdk/client.py +19 -94
- hatchet_sdk/clients/admin.py +309 -389
- hatchet_sdk/clients/dispatcher/action_listener.py +131 -109
- hatchet_sdk/clients/dispatcher/dispatcher.py +39 -37
- hatchet_sdk/clients/durable_event_listener.py +327 -0
- hatchet_sdk/clients/event_ts.py +23 -10
- hatchet_sdk/clients/events.py +96 -99
- hatchet_sdk/clients/rest/__init__.py +35 -0
- hatchet_sdk/clients/rest/api/__init__.py +2 -0
- hatchet_sdk/clients/rest/api/log_api.py +258 -0
- hatchet_sdk/clients/rest/api/task_api.py +2200 -0
- hatchet_sdk/clients/rest/api/workflow_runs_api.py +1274 -116
- hatchet_sdk/clients/rest/api_client.py +1 -1
- hatchet_sdk/clients/rest/configuration.py +8 -1
- hatchet_sdk/clients/rest/exceptions.py +21 -0
- hatchet_sdk/clients/rest/models/__init__.py +33 -0
- hatchet_sdk/clients/rest/models/tenant.py +4 -0
- hatchet_sdk/clients/rest/models/tenant_version.py +37 -0
- hatchet_sdk/clients/rest/models/update_tenant_request.py +7 -0
- hatchet_sdk/clients/rest/models/v1_cancel_task_request.py +104 -0
- hatchet_sdk/clients/rest/models/v1_dag_children.py +102 -0
- hatchet_sdk/clients/rest/models/v1_log_line.py +94 -0
- hatchet_sdk/clients/rest/models/v1_log_line_level.py +39 -0
- hatchet_sdk/clients/rest/models/v1_log_line_list.py +110 -0
- hatchet_sdk/clients/rest/models/v1_replay_task_request.py +104 -0
- hatchet_sdk/clients/rest/models/v1_task.py +174 -0
- hatchet_sdk/clients/rest/models/v1_task_event.py +118 -0
- hatchet_sdk/clients/rest/models/v1_task_event_list.py +110 -0
- hatchet_sdk/clients/rest/models/v1_task_event_type.py +55 -0
- hatchet_sdk/clients/rest/models/v1_task_filter.py +106 -0
- hatchet_sdk/clients/rest/models/v1_task_point_metric.py +92 -0
- hatchet_sdk/clients/rest/models/v1_task_point_metrics.py +100 -0
- hatchet_sdk/clients/rest/models/v1_task_run_metric.py +88 -0
- hatchet_sdk/clients/rest/models/v1_task_run_status.py +40 -0
- hatchet_sdk/clients/rest/models/v1_task_status.py +40 -0
- hatchet_sdk/clients/rest/models/v1_task_summary.py +228 -0
- hatchet_sdk/clients/rest/models/v1_task_summary_list.py +110 -0
- hatchet_sdk/clients/rest/models/v1_trigger_workflow_run_request.py +95 -0
- hatchet_sdk/clients/rest/models/v1_workflow_run.py +171 -0
- hatchet_sdk/clients/rest/models/v1_workflow_run_details.py +145 -0
- hatchet_sdk/clients/rest/models/v1_workflow_run_display_name.py +98 -0
- hatchet_sdk/clients/rest/models/v1_workflow_run_display_name_list.py +114 -0
- hatchet_sdk/clients/rest/models/v1_workflow_type.py +37 -0
- hatchet_sdk/clients/rest/models/workflow_run_shape_item_for_workflow_run_details.py +104 -0
- hatchet_sdk/clients/rest/rest.py +37 -26
- hatchet_sdk/clients/rest/tenacity_utils.py +1 -1
- hatchet_sdk/clients/rest_client.py +153 -116
- hatchet_sdk/clients/run_event_listener.py +65 -60
- hatchet_sdk/clients/workflow_listener.py +75 -66
- hatchet_sdk/config.py +117 -0
- hatchet_sdk/connection.py +27 -13
- hatchet_sdk/context/__init__.py +0 -1
- hatchet_sdk/context/context.py +118 -280
- hatchet_sdk/contracts/dispatcher_pb2_grpc.py +1 -1
- hatchet_sdk/contracts/events_pb2.py +2 -2
- hatchet_sdk/contracts/events_pb2_grpc.py +1 -1
- hatchet_sdk/contracts/v1/dispatcher_pb2.py +36 -0
- hatchet_sdk/contracts/v1/dispatcher_pb2.pyi +38 -0
- hatchet_sdk/contracts/v1/dispatcher_pb2_grpc.py +145 -0
- hatchet_sdk/contracts/v1/shared/condition_pb2.py +39 -0
- hatchet_sdk/contracts/v1/shared/condition_pb2.pyi +72 -0
- hatchet_sdk/contracts/v1/shared/condition_pb2_grpc.py +29 -0
- hatchet_sdk/contracts/v1/workflows_pb2.py +67 -0
- hatchet_sdk/contracts/v1/workflows_pb2.pyi +228 -0
- hatchet_sdk/contracts/v1/workflows_pb2_grpc.py +234 -0
- hatchet_sdk/contracts/workflows_pb2_grpc.py +1 -1
- hatchet_sdk/features/cron.py +43 -57
- hatchet_sdk/features/scheduled.py +60 -74
- hatchet_sdk/hatchet.py +491 -218
- hatchet_sdk/labels.py +4 -6
- hatchet_sdk/metadata.py +1 -1
- hatchet_sdk/opentelemetry/instrumentor.py +17 -18
- hatchet_sdk/rate_limit.py +40 -55
- hatchet_sdk/runnables/contextvars.py +12 -0
- hatchet_sdk/runnables/standalone.py +194 -0
- hatchet_sdk/runnables/task.py +144 -0
- hatchet_sdk/runnables/types.py +138 -0
- hatchet_sdk/runnables/workflow.py +764 -0
- hatchet_sdk/token.py +13 -9
- hatchet_sdk/utils/aio_utils.py +0 -119
- hatchet_sdk/utils/proto_enums.py +47 -0
- hatchet_sdk/utils/timedelta_to_expression.py +23 -0
- hatchet_sdk/utils/typing.py +10 -2
- hatchet_sdk/v0/__init__.py +251 -0
- hatchet_sdk/v0/client.py +119 -0
- hatchet_sdk/v0/clients/admin.py +541 -0
- hatchet_sdk/v0/clients/dispatcher/action_listener.py +422 -0
- hatchet_sdk/v0/clients/dispatcher/dispatcher.py +204 -0
- hatchet_sdk/v0/clients/event_ts.py +28 -0
- hatchet_sdk/v0/clients/events.py +182 -0
- hatchet_sdk/v0/clients/rest/__init__.py +307 -0
- hatchet_sdk/v0/clients/rest/api/__init__.py +19 -0
- hatchet_sdk/v0/clients/rest/api/api_token_api.py +858 -0
- hatchet_sdk/v0/clients/rest/api/default_api.py +2259 -0
- hatchet_sdk/v0/clients/rest/api/event_api.py +2548 -0
- hatchet_sdk/v0/clients/rest/api/github_api.py +331 -0
- hatchet_sdk/v0/clients/rest/api/healthcheck_api.py +483 -0
- hatchet_sdk/v0/clients/rest/api/log_api.py +449 -0
- hatchet_sdk/v0/clients/rest/api/metadata_api.py +728 -0
- hatchet_sdk/v0/clients/rest/api/rate_limits_api.py +423 -0
- hatchet_sdk/v0/clients/rest/api/slack_api.py +577 -0
- hatchet_sdk/v0/clients/rest/api/sns_api.py +872 -0
- hatchet_sdk/v0/clients/rest/api/step_run_api.py +2202 -0
- hatchet_sdk/v0/clients/rest/api/tenant_api.py +4430 -0
- hatchet_sdk/v0/clients/rest/api/user_api.py +2888 -0
- hatchet_sdk/v0/clients/rest/api/worker_api.py +858 -0
- hatchet_sdk/v0/clients/rest/api/workflow_api.py +6312 -0
- hatchet_sdk/v0/clients/rest/api/workflow_run_api.py +1932 -0
- hatchet_sdk/v0/clients/rest/api/workflow_runs_api.py +610 -0
- hatchet_sdk/v0/clients/rest/api_client.py +759 -0
- hatchet_sdk/v0/clients/rest/api_response.py +22 -0
- hatchet_sdk/v0/clients/rest/configuration.py +611 -0
- hatchet_sdk/v0/clients/rest/exceptions.py +200 -0
- hatchet_sdk/v0/clients/rest/models/__init__.py +274 -0
- hatchet_sdk/v0/clients/rest/models/accept_invite_request.py +83 -0
- hatchet_sdk/v0/clients/rest/models/api_error.py +102 -0
- hatchet_sdk/v0/clients/rest/models/api_errors.py +100 -0
- hatchet_sdk/v0/clients/rest/models/api_meta.py +144 -0
- hatchet_sdk/v0/clients/rest/models/api_meta_auth.py +85 -0
- hatchet_sdk/v0/clients/rest/models/api_meta_integration.py +88 -0
- hatchet_sdk/v0/clients/rest/models/api_meta_posthog.py +90 -0
- hatchet_sdk/v0/clients/rest/models/api_resource_meta.py +98 -0
- hatchet_sdk/v0/clients/rest/models/api_token.py +105 -0
- hatchet_sdk/v0/clients/rest/models/bulk_create_event_request.py +100 -0
- hatchet_sdk/v0/clients/rest/models/bulk_create_event_response.py +110 -0
- hatchet_sdk/v0/clients/rest/models/cancel_event_request.py +85 -0
- hatchet_sdk/v0/clients/rest/models/cancel_step_run_request.py +83 -0
- hatchet_sdk/v0/clients/rest/models/concurrency_limit_strategy.py +39 -0
- hatchet_sdk/v0/clients/rest/models/create_api_token_request.py +92 -0
- hatchet_sdk/v0/clients/rest/models/create_api_token_response.py +83 -0
- hatchet_sdk/v0/clients/rest/models/create_cron_workflow_trigger_request.py +98 -0
- hatchet_sdk/v0/clients/rest/models/create_event_request.py +95 -0
- hatchet_sdk/v0/clients/rest/models/create_pull_request_from_step_run.py +83 -0
- hatchet_sdk/v0/clients/rest/models/create_sns_integration_request.py +85 -0
- hatchet_sdk/v0/clients/rest/models/create_tenant_alert_email_group_request.py +83 -0
- hatchet_sdk/v0/clients/rest/models/create_tenant_invite_request.py +86 -0
- hatchet_sdk/v0/clients/rest/models/create_tenant_request.py +84 -0
- hatchet_sdk/v0/clients/rest/models/cron_workflows.py +131 -0
- hatchet_sdk/v0/clients/rest/models/cron_workflows_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/cron_workflows_method.py +37 -0
- hatchet_sdk/v0/clients/rest/models/cron_workflows_order_by_field.py +37 -0
- hatchet_sdk/v0/clients/rest/models/event.py +143 -0
- hatchet_sdk/v0/clients/rest/models/event_data.py +83 -0
- hatchet_sdk/v0/clients/rest/models/event_key_list.py +98 -0
- hatchet_sdk/v0/clients/rest/models/event_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/event_order_by_direction.py +37 -0
- hatchet_sdk/v0/clients/rest/models/event_order_by_field.py +36 -0
- hatchet_sdk/v0/clients/rest/models/event_update_cancel200_response.py +85 -0
- hatchet_sdk/v0/clients/rest/models/event_workflow_run_summary.py +116 -0
- hatchet_sdk/v0/clients/rest/models/events.py +110 -0
- hatchet_sdk/v0/clients/rest/models/get_step_run_diff_response.py +100 -0
- hatchet_sdk/v0/clients/rest/models/github_app_installation.py +107 -0
- hatchet_sdk/v0/clients/rest/models/github_branch.py +86 -0
- hatchet_sdk/v0/clients/rest/models/github_repo.py +86 -0
- hatchet_sdk/v0/clients/rest/models/info_get_version200_response.py +83 -0
- hatchet_sdk/v0/clients/rest/models/job.py +132 -0
- hatchet_sdk/v0/clients/rest/models/job_run.py +176 -0
- hatchet_sdk/v0/clients/rest/models/job_run_status.py +41 -0
- hatchet_sdk/v0/clients/rest/models/link_github_repository_request.py +106 -0
- hatchet_sdk/v0/clients/rest/models/list_api_tokens_response.py +110 -0
- hatchet_sdk/v0/clients/rest/models/list_github_app_installations_response.py +112 -0
- hatchet_sdk/v0/clients/rest/models/list_pull_requests_response.py +100 -0
- hatchet_sdk/v0/clients/rest/models/list_slack_webhooks.py +110 -0
- hatchet_sdk/v0/clients/rest/models/list_sns_integrations.py +110 -0
- hatchet_sdk/v0/clients/rest/models/log_line.py +94 -0
- hatchet_sdk/v0/clients/rest/models/log_line_level.py +39 -0
- hatchet_sdk/v0/clients/rest/models/log_line_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/log_line_order_by_direction.py +37 -0
- hatchet_sdk/v0/clients/rest/models/log_line_order_by_field.py +36 -0
- hatchet_sdk/v0/clients/rest/models/pagination_response.py +95 -0
- hatchet_sdk/v0/clients/rest/models/pull_request.py +112 -0
- hatchet_sdk/v0/clients/rest/models/pull_request_state.py +37 -0
- hatchet_sdk/v0/clients/rest/models/queue_metrics.py +97 -0
- hatchet_sdk/v0/clients/rest/models/rate_limit.py +117 -0
- hatchet_sdk/v0/clients/rest/models/rate_limit_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/rate_limit_order_by_direction.py +37 -0
- hatchet_sdk/v0/clients/rest/models/rate_limit_order_by_field.py +38 -0
- hatchet_sdk/v0/clients/rest/models/recent_step_runs.py +118 -0
- hatchet_sdk/v0/clients/rest/models/reject_invite_request.py +83 -0
- hatchet_sdk/v0/clients/rest/models/replay_event_request.py +85 -0
- hatchet_sdk/v0/clients/rest/models/replay_workflow_runs_request.py +85 -0
- hatchet_sdk/v0/clients/rest/models/replay_workflow_runs_response.py +100 -0
- hatchet_sdk/v0/clients/rest/models/rerun_step_run_request.py +83 -0
- hatchet_sdk/v0/clients/rest/models/schedule_workflow_run_request.py +92 -0
- hatchet_sdk/v0/clients/rest/models/scheduled_run_status.py +42 -0
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows.py +149 -0
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows_method.py +37 -0
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows_order_by_field.py +37 -0
- hatchet_sdk/v0/clients/rest/models/semaphore_slots.py +113 -0
- hatchet_sdk/v0/clients/rest/models/slack_webhook.py +127 -0
- hatchet_sdk/v0/clients/rest/models/sns_integration.py +114 -0
- hatchet_sdk/v0/clients/rest/models/step.py +123 -0
- hatchet_sdk/v0/clients/rest/models/step_run.py +202 -0
- hatchet_sdk/v0/clients/rest/models/step_run_archive.py +142 -0
- hatchet_sdk/v0/clients/rest/models/step_run_archive_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/step_run_diff.py +91 -0
- hatchet_sdk/v0/clients/rest/models/step_run_event.py +122 -0
- hatchet_sdk/v0/clients/rest/models/step_run_event_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/step_run_event_reason.py +52 -0
- hatchet_sdk/v0/clients/rest/models/step_run_event_severity.py +38 -0
- hatchet_sdk/v0/clients/rest/models/step_run_status.py +44 -0
- hatchet_sdk/v0/clients/rest/models/tenant.py +118 -0
- hatchet_sdk/v0/clients/rest/models/tenant_alert_email_group.py +98 -0
- hatchet_sdk/v0/clients/rest/models/tenant_alert_email_group_list.py +112 -0
- hatchet_sdk/v0/clients/rest/models/tenant_alerting_settings.py +143 -0
- hatchet_sdk/v0/clients/rest/models/tenant_invite.py +120 -0
- hatchet_sdk/v0/clients/rest/models/tenant_invite_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/tenant_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/tenant_member.py +123 -0
- hatchet_sdk/v0/clients/rest/models/tenant_member_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/tenant_member_role.py +38 -0
- hatchet_sdk/v0/clients/rest/models/tenant_queue_metrics.py +116 -0
- hatchet_sdk/v0/clients/rest/models/tenant_resource.py +40 -0
- hatchet_sdk/v0/clients/rest/models/tenant_resource_limit.py +135 -0
- hatchet_sdk/v0/clients/rest/models/tenant_resource_policy.py +102 -0
- hatchet_sdk/v0/clients/rest/models/tenant_step_run_queue_metrics.py +83 -0
- hatchet_sdk/v0/clients/rest/models/trigger_workflow_run_request.py +91 -0
- hatchet_sdk/v0/clients/rest/models/update_tenant_alert_email_group_request.py +83 -0
- hatchet_sdk/v0/clients/rest/models/update_tenant_invite_request.py +85 -0
- hatchet_sdk/v0/clients/rest/models/update_tenant_request.py +137 -0
- hatchet_sdk/v0/clients/rest/models/update_worker_request.py +87 -0
- hatchet_sdk/v0/clients/rest/models/user.py +126 -0
- hatchet_sdk/v0/clients/rest/models/user_change_password_request.py +88 -0
- hatchet_sdk/v0/clients/rest/models/user_login_request.py +86 -0
- hatchet_sdk/v0/clients/rest/models/user_register_request.py +91 -0
- hatchet_sdk/v0/clients/rest/models/user_tenant_memberships_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/user_tenant_public.py +86 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker.py +100 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker_create_request.py +94 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker_create_response.py +98 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker_created.py +102 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker_list_response.py +110 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker_request.py +102 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker_request_list_response.py +104 -0
- hatchet_sdk/v0/clients/rest/models/webhook_worker_request_method.py +38 -0
- hatchet_sdk/v0/clients/rest/models/worker.py +239 -0
- hatchet_sdk/v0/clients/rest/models/worker_label.py +102 -0
- hatchet_sdk/v0/clients/rest/models/worker_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/worker_runtime_info.py +103 -0
- hatchet_sdk/v0/clients/rest/models/worker_runtime_sdks.py +38 -0
- hatchet_sdk/v0/clients/rest/models/worker_type.py +38 -0
- hatchet_sdk/v0/clients/rest/models/workflow.py +165 -0
- hatchet_sdk/v0/clients/rest/models/workflow_concurrency.py +107 -0
- hatchet_sdk/v0/clients/rest/models/workflow_deployment_config.py +136 -0
- hatchet_sdk/v0/clients/rest/models/workflow_kind.py +38 -0
- hatchet_sdk/v0/clients/rest/models/workflow_list.py +120 -0
- hatchet_sdk/v0/clients/rest/models/workflow_metrics.py +97 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run.py +188 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run_cancel200_response.py +85 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run_list.py +110 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run_order_by_direction.py +37 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run_order_by_field.py +39 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run_shape.py +186 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run_status.py +42 -0
- hatchet_sdk/v0/clients/rest/models/workflow_run_triggered_by.py +112 -0
- hatchet_sdk/v0/clients/rest/models/workflow_runs_cancel_request.py +85 -0
- hatchet_sdk/v0/clients/rest/models/workflow_runs_metrics.py +94 -0
- hatchet_sdk/v0/clients/rest/models/workflow_runs_metrics_counts.py +104 -0
- hatchet_sdk/v0/clients/rest/models/workflow_tag.py +84 -0
- hatchet_sdk/v0/clients/rest/models/workflow_trigger_cron_ref.py +86 -0
- hatchet_sdk/v0/clients/rest/models/workflow_trigger_event_ref.py +86 -0
- hatchet_sdk/v0/clients/rest/models/workflow_triggers.py +141 -0
- hatchet_sdk/v0/clients/rest/models/workflow_update_request.py +85 -0
- hatchet_sdk/v0/clients/rest/models/workflow_version.py +170 -0
- hatchet_sdk/v0/clients/rest/models/workflow_version_concurrency.py +114 -0
- hatchet_sdk/v0/clients/rest/models/workflow_version_definition.py +85 -0
- hatchet_sdk/v0/clients/rest/models/workflow_version_meta.py +123 -0
- hatchet_sdk/v0/clients/rest/models/workflow_workers_count.py +95 -0
- hatchet_sdk/v0/clients/rest/rest.py +187 -0
- hatchet_sdk/v0/clients/rest/tenacity_utils.py +39 -0
- hatchet_sdk/v0/clients/rest_client.py +622 -0
- hatchet_sdk/v0/clients/run_event_listener.py +260 -0
- hatchet_sdk/v0/clients/workflow_listener.py +277 -0
- hatchet_sdk/v0/connection.py +63 -0
- hatchet_sdk/v0/context/__init__.py +1 -0
- hatchet_sdk/v0/context/context.py +446 -0
- hatchet_sdk/v0/context/worker_context.py +28 -0
- hatchet_sdk/v0/contracts/dispatcher_pb2.py +102 -0
- hatchet_sdk/v0/contracts/dispatcher_pb2.pyi +387 -0
- hatchet_sdk/v0/contracts/dispatcher_pb2_grpc.py +621 -0
- hatchet_sdk/v0/contracts/events_pb2.py +46 -0
- hatchet_sdk/v0/contracts/events_pb2.pyi +87 -0
- hatchet_sdk/v0/contracts/events_pb2_grpc.py +274 -0
- hatchet_sdk/v0/contracts/workflows_pb2.py +80 -0
- hatchet_sdk/v0/contracts/workflows_pb2.pyi +312 -0
- hatchet_sdk/v0/contracts/workflows_pb2_grpc.py +277 -0
- hatchet_sdk/v0/features/cron.py +286 -0
- hatchet_sdk/v0/features/scheduled.py +248 -0
- hatchet_sdk/v0/hatchet.py +310 -0
- hatchet_sdk/v0/labels.py +10 -0
- hatchet_sdk/v0/logger.py +13 -0
- hatchet_sdk/v0/metadata.py +2 -0
- hatchet_sdk/v0/opentelemetry/instrumentor.py +396 -0
- hatchet_sdk/v0/rate_limit.py +126 -0
- hatchet_sdk/v0/token.py +27 -0
- hatchet_sdk/v0/utils/aio_utils.py +137 -0
- hatchet_sdk/v0/utils/backoff.py +9 -0
- hatchet_sdk/v0/utils/typing.py +12 -0
- hatchet_sdk/{v2 → v0/v2}/callable.py +8 -8
- hatchet_sdk/{v2 → v0/v2}/concurrency.py +2 -2
- hatchet_sdk/{v2 → v0/v2}/hatchet.py +10 -10
- hatchet_sdk/v0/worker/__init__.py +1 -0
- hatchet_sdk/v0/worker/action_listener_process.py +294 -0
- hatchet_sdk/v0/worker/runner/run_loop_manager.py +112 -0
- hatchet_sdk/v0/worker/runner/runner.py +460 -0
- hatchet_sdk/v0/worker/runner/utils/capture_logs.py +81 -0
- hatchet_sdk/v0/worker/worker.py +391 -0
- hatchet_sdk/{workflow.py → v0/workflow.py} +4 -4
- hatchet_sdk/v0/workflow_run.py +59 -0
- hatchet_sdk/waits.py +120 -0
- hatchet_sdk/worker/__init__.py +0 -1
- hatchet_sdk/worker/action_listener_process.py +80 -55
- hatchet_sdk/worker/runner/run_loop_manager.py +46 -34
- hatchet_sdk/worker/runner/runner.py +82 -87
- hatchet_sdk/worker/runner/utils/capture_logs.py +26 -23
- hatchet_sdk/worker/worker.py +172 -149
- hatchet_sdk/workflow_run.py +7 -21
- {hatchet_sdk-0.47.1.dist-info → hatchet_sdk-1.0.0a1.dist-info}/METADATA +2 -2
- hatchet_sdk-1.0.0a1.dist-info/RECORD +505 -0
- {hatchet_sdk-0.47.1.dist-info → hatchet_sdk-1.0.0a1.dist-info}/entry_points.txt +2 -0
- hatchet_sdk/utils/serialization.py +0 -18
- hatchet_sdk-0.47.1.dist-info/RECORD +0 -237
- /hatchet_sdk/{loader.py → v0/loader.py} +0 -0
- /hatchet_sdk/{semver.py → v0/semver.py} +0 -0
- /hatchet_sdk/{utils → v0/utils}/types.py +0 -0
- /hatchet_sdk/{worker → v0/worker}/runner/utils/error_with_traceback.py +0 -0
- {hatchet_sdk-0.47.1.dist-info → hatchet_sdk-1.0.0a1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
from google.protobuf import timestamp_pb2 as _timestamp_pb2
|
|
2
|
+
from hatchet_sdk.contracts.v1.shared import condition_pb2 as _condition_pb2
|
|
3
|
+
from google.protobuf.internal import containers as _containers
|
|
4
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
|
6
|
+
from google.protobuf import message as _message
|
|
7
|
+
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
|
|
8
|
+
|
|
9
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
10
|
+
|
|
11
|
+
class StickyStrategy(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
12
|
+
__slots__ = ()
|
|
13
|
+
SOFT: _ClassVar[StickyStrategy]
|
|
14
|
+
HARD: _ClassVar[StickyStrategy]
|
|
15
|
+
|
|
16
|
+
class RateLimitDuration(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
17
|
+
__slots__ = ()
|
|
18
|
+
SECOND: _ClassVar[RateLimitDuration]
|
|
19
|
+
MINUTE: _ClassVar[RateLimitDuration]
|
|
20
|
+
HOUR: _ClassVar[RateLimitDuration]
|
|
21
|
+
DAY: _ClassVar[RateLimitDuration]
|
|
22
|
+
WEEK: _ClassVar[RateLimitDuration]
|
|
23
|
+
MONTH: _ClassVar[RateLimitDuration]
|
|
24
|
+
YEAR: _ClassVar[RateLimitDuration]
|
|
25
|
+
|
|
26
|
+
class ConcurrencyLimitStrategy(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
27
|
+
__slots__ = ()
|
|
28
|
+
CANCEL_IN_PROGRESS: _ClassVar[ConcurrencyLimitStrategy]
|
|
29
|
+
DROP_NEWEST: _ClassVar[ConcurrencyLimitStrategy]
|
|
30
|
+
QUEUE_NEWEST: _ClassVar[ConcurrencyLimitStrategy]
|
|
31
|
+
GROUP_ROUND_ROBIN: _ClassVar[ConcurrencyLimitStrategy]
|
|
32
|
+
CANCEL_NEWEST: _ClassVar[ConcurrencyLimitStrategy]
|
|
33
|
+
|
|
34
|
+
class WorkerLabelComparator(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
35
|
+
__slots__ = ()
|
|
36
|
+
EQUAL: _ClassVar[WorkerLabelComparator]
|
|
37
|
+
NOT_EQUAL: _ClassVar[WorkerLabelComparator]
|
|
38
|
+
GREATER_THAN: _ClassVar[WorkerLabelComparator]
|
|
39
|
+
GREATER_THAN_OR_EQUAL: _ClassVar[WorkerLabelComparator]
|
|
40
|
+
LESS_THAN: _ClassVar[WorkerLabelComparator]
|
|
41
|
+
LESS_THAN_OR_EQUAL: _ClassVar[WorkerLabelComparator]
|
|
42
|
+
SOFT: StickyStrategy
|
|
43
|
+
HARD: StickyStrategy
|
|
44
|
+
SECOND: RateLimitDuration
|
|
45
|
+
MINUTE: RateLimitDuration
|
|
46
|
+
HOUR: RateLimitDuration
|
|
47
|
+
DAY: RateLimitDuration
|
|
48
|
+
WEEK: RateLimitDuration
|
|
49
|
+
MONTH: RateLimitDuration
|
|
50
|
+
YEAR: RateLimitDuration
|
|
51
|
+
CANCEL_IN_PROGRESS: ConcurrencyLimitStrategy
|
|
52
|
+
DROP_NEWEST: ConcurrencyLimitStrategy
|
|
53
|
+
QUEUE_NEWEST: ConcurrencyLimitStrategy
|
|
54
|
+
GROUP_ROUND_ROBIN: ConcurrencyLimitStrategy
|
|
55
|
+
CANCEL_NEWEST: ConcurrencyLimitStrategy
|
|
56
|
+
EQUAL: WorkerLabelComparator
|
|
57
|
+
NOT_EQUAL: WorkerLabelComparator
|
|
58
|
+
GREATER_THAN: WorkerLabelComparator
|
|
59
|
+
GREATER_THAN_OR_EQUAL: WorkerLabelComparator
|
|
60
|
+
LESS_THAN: WorkerLabelComparator
|
|
61
|
+
LESS_THAN_OR_EQUAL: WorkerLabelComparator
|
|
62
|
+
|
|
63
|
+
class CancelTasksRequest(_message.Message):
|
|
64
|
+
__slots__ = ("externalIds", "filter")
|
|
65
|
+
EXTERNALIDS_FIELD_NUMBER: _ClassVar[int]
|
|
66
|
+
FILTER_FIELD_NUMBER: _ClassVar[int]
|
|
67
|
+
externalIds: _containers.RepeatedScalarFieldContainer[str]
|
|
68
|
+
filter: TasksFilter
|
|
69
|
+
def __init__(self, externalIds: _Optional[_Iterable[str]] = ..., filter: _Optional[_Union[TasksFilter, _Mapping]] = ...) -> None: ...
|
|
70
|
+
|
|
71
|
+
class ReplayTasksRequest(_message.Message):
|
|
72
|
+
__slots__ = ("externalIds", "filter")
|
|
73
|
+
EXTERNALIDS_FIELD_NUMBER: _ClassVar[int]
|
|
74
|
+
FILTER_FIELD_NUMBER: _ClassVar[int]
|
|
75
|
+
externalIds: _containers.RepeatedScalarFieldContainer[str]
|
|
76
|
+
filter: TasksFilter
|
|
77
|
+
def __init__(self, externalIds: _Optional[_Iterable[str]] = ..., filter: _Optional[_Union[TasksFilter, _Mapping]] = ...) -> None: ...
|
|
78
|
+
|
|
79
|
+
class TasksFilter(_message.Message):
|
|
80
|
+
__slots__ = ("statuses", "since", "until", "workflow_ids", "additional_metadata")
|
|
81
|
+
STATUSES_FIELD_NUMBER: _ClassVar[int]
|
|
82
|
+
SINCE_FIELD_NUMBER: _ClassVar[int]
|
|
83
|
+
UNTIL_FIELD_NUMBER: _ClassVar[int]
|
|
84
|
+
WORKFLOW_IDS_FIELD_NUMBER: _ClassVar[int]
|
|
85
|
+
ADDITIONAL_METADATA_FIELD_NUMBER: _ClassVar[int]
|
|
86
|
+
statuses: _containers.RepeatedScalarFieldContainer[str]
|
|
87
|
+
since: _timestamp_pb2.Timestamp
|
|
88
|
+
until: _timestamp_pb2.Timestamp
|
|
89
|
+
workflow_ids: _containers.RepeatedScalarFieldContainer[str]
|
|
90
|
+
additional_metadata: _containers.RepeatedScalarFieldContainer[str]
|
|
91
|
+
def __init__(self, statuses: _Optional[_Iterable[str]] = ..., since: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., until: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., workflow_ids: _Optional[_Iterable[str]] = ..., additional_metadata: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
92
|
+
|
|
93
|
+
class CancelTasksResponse(_message.Message):
|
|
94
|
+
__slots__ = ("cancelled_tasks",)
|
|
95
|
+
CANCELLED_TASKS_FIELD_NUMBER: _ClassVar[int]
|
|
96
|
+
cancelled_tasks: _containers.RepeatedScalarFieldContainer[str]
|
|
97
|
+
def __init__(self, cancelled_tasks: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
98
|
+
|
|
99
|
+
class ReplayTasksResponse(_message.Message):
|
|
100
|
+
__slots__ = ("replayed_tasks",)
|
|
101
|
+
REPLAYED_TASKS_FIELD_NUMBER: _ClassVar[int]
|
|
102
|
+
replayed_tasks: _containers.RepeatedScalarFieldContainer[str]
|
|
103
|
+
def __init__(self, replayed_tasks: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
104
|
+
|
|
105
|
+
class TriggerWorkflowRunRequest(_message.Message):
|
|
106
|
+
__slots__ = ("workflow_name", "input", "additional_metadata")
|
|
107
|
+
WORKFLOW_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
108
|
+
INPUT_FIELD_NUMBER: _ClassVar[int]
|
|
109
|
+
ADDITIONAL_METADATA_FIELD_NUMBER: _ClassVar[int]
|
|
110
|
+
workflow_name: str
|
|
111
|
+
input: bytes
|
|
112
|
+
additional_metadata: bytes
|
|
113
|
+
def __init__(self, workflow_name: _Optional[str] = ..., input: _Optional[bytes] = ..., additional_metadata: _Optional[bytes] = ...) -> None: ...
|
|
114
|
+
|
|
115
|
+
class TriggerWorkflowRunResponse(_message.Message):
|
|
116
|
+
__slots__ = ("external_id",)
|
|
117
|
+
EXTERNAL_ID_FIELD_NUMBER: _ClassVar[int]
|
|
118
|
+
external_id: str
|
|
119
|
+
def __init__(self, external_id: _Optional[str] = ...) -> None: ...
|
|
120
|
+
|
|
121
|
+
class CreateWorkflowVersionRequest(_message.Message):
|
|
122
|
+
__slots__ = ("name", "description", "version", "event_triggers", "cron_triggers", "tasks", "concurrency", "cron_input", "on_failure_task", "sticky")
|
|
123
|
+
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
124
|
+
DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
|
|
125
|
+
VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
126
|
+
EVENT_TRIGGERS_FIELD_NUMBER: _ClassVar[int]
|
|
127
|
+
CRON_TRIGGERS_FIELD_NUMBER: _ClassVar[int]
|
|
128
|
+
TASKS_FIELD_NUMBER: _ClassVar[int]
|
|
129
|
+
CONCURRENCY_FIELD_NUMBER: _ClassVar[int]
|
|
130
|
+
CRON_INPUT_FIELD_NUMBER: _ClassVar[int]
|
|
131
|
+
ON_FAILURE_TASK_FIELD_NUMBER: _ClassVar[int]
|
|
132
|
+
STICKY_FIELD_NUMBER: _ClassVar[int]
|
|
133
|
+
name: str
|
|
134
|
+
description: str
|
|
135
|
+
version: str
|
|
136
|
+
event_triggers: _containers.RepeatedScalarFieldContainer[str]
|
|
137
|
+
cron_triggers: _containers.RepeatedScalarFieldContainer[str]
|
|
138
|
+
tasks: _containers.RepeatedCompositeFieldContainer[CreateTaskOpts]
|
|
139
|
+
concurrency: Concurrency
|
|
140
|
+
cron_input: str
|
|
141
|
+
on_failure_task: CreateTaskOpts
|
|
142
|
+
sticky: StickyStrategy
|
|
143
|
+
def __init__(self, name: _Optional[str] = ..., description: _Optional[str] = ..., version: _Optional[str] = ..., event_triggers: _Optional[_Iterable[str]] = ..., cron_triggers: _Optional[_Iterable[str]] = ..., tasks: _Optional[_Iterable[_Union[CreateTaskOpts, _Mapping]]] = ..., concurrency: _Optional[_Union[Concurrency, _Mapping]] = ..., cron_input: _Optional[str] = ..., on_failure_task: _Optional[_Union[CreateTaskOpts, _Mapping]] = ..., sticky: _Optional[_Union[StickyStrategy, str]] = ...) -> None: ...
|
|
144
|
+
|
|
145
|
+
class Concurrency(_message.Message):
|
|
146
|
+
__slots__ = ("expression", "max_runs", "limit_strategy")
|
|
147
|
+
EXPRESSION_FIELD_NUMBER: _ClassVar[int]
|
|
148
|
+
MAX_RUNS_FIELD_NUMBER: _ClassVar[int]
|
|
149
|
+
LIMIT_STRATEGY_FIELD_NUMBER: _ClassVar[int]
|
|
150
|
+
expression: str
|
|
151
|
+
max_runs: int
|
|
152
|
+
limit_strategy: ConcurrencyLimitStrategy
|
|
153
|
+
def __init__(self, expression: _Optional[str] = ..., max_runs: _Optional[int] = ..., limit_strategy: _Optional[_Union[ConcurrencyLimitStrategy, str]] = ...) -> None: ...
|
|
154
|
+
|
|
155
|
+
class DesiredWorkerLabels(_message.Message):
|
|
156
|
+
__slots__ = ("strValue", "intValue", "required", "comparator", "weight")
|
|
157
|
+
STRVALUE_FIELD_NUMBER: _ClassVar[int]
|
|
158
|
+
INTVALUE_FIELD_NUMBER: _ClassVar[int]
|
|
159
|
+
REQUIRED_FIELD_NUMBER: _ClassVar[int]
|
|
160
|
+
COMPARATOR_FIELD_NUMBER: _ClassVar[int]
|
|
161
|
+
WEIGHT_FIELD_NUMBER: _ClassVar[int]
|
|
162
|
+
strValue: str
|
|
163
|
+
intValue: int
|
|
164
|
+
required: bool
|
|
165
|
+
comparator: WorkerLabelComparator
|
|
166
|
+
weight: int
|
|
167
|
+
def __init__(self, strValue: _Optional[str] = ..., intValue: _Optional[int] = ..., required: bool = ..., comparator: _Optional[_Union[WorkerLabelComparator, str]] = ..., weight: _Optional[int] = ...) -> None: ...
|
|
168
|
+
|
|
169
|
+
class CreateTaskOpts(_message.Message):
|
|
170
|
+
__slots__ = ("readable_id", "action", "timeout", "inputs", "parents", "retries", "rate_limits", "worker_labels", "backoff_factor", "backoff_max_seconds", "concurrency", "conditions", "schedule_timeout")
|
|
171
|
+
class WorkerLabelsEntry(_message.Message):
|
|
172
|
+
__slots__ = ("key", "value")
|
|
173
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
174
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
175
|
+
key: str
|
|
176
|
+
value: DesiredWorkerLabels
|
|
177
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[DesiredWorkerLabels, _Mapping]] = ...) -> None: ...
|
|
178
|
+
READABLE_ID_FIELD_NUMBER: _ClassVar[int]
|
|
179
|
+
ACTION_FIELD_NUMBER: _ClassVar[int]
|
|
180
|
+
TIMEOUT_FIELD_NUMBER: _ClassVar[int]
|
|
181
|
+
INPUTS_FIELD_NUMBER: _ClassVar[int]
|
|
182
|
+
PARENTS_FIELD_NUMBER: _ClassVar[int]
|
|
183
|
+
RETRIES_FIELD_NUMBER: _ClassVar[int]
|
|
184
|
+
RATE_LIMITS_FIELD_NUMBER: _ClassVar[int]
|
|
185
|
+
WORKER_LABELS_FIELD_NUMBER: _ClassVar[int]
|
|
186
|
+
BACKOFF_FACTOR_FIELD_NUMBER: _ClassVar[int]
|
|
187
|
+
BACKOFF_MAX_SECONDS_FIELD_NUMBER: _ClassVar[int]
|
|
188
|
+
CONCURRENCY_FIELD_NUMBER: _ClassVar[int]
|
|
189
|
+
CONDITIONS_FIELD_NUMBER: _ClassVar[int]
|
|
190
|
+
SCHEDULE_TIMEOUT_FIELD_NUMBER: _ClassVar[int]
|
|
191
|
+
readable_id: str
|
|
192
|
+
action: str
|
|
193
|
+
timeout: str
|
|
194
|
+
inputs: str
|
|
195
|
+
parents: _containers.RepeatedScalarFieldContainer[str]
|
|
196
|
+
retries: int
|
|
197
|
+
rate_limits: _containers.RepeatedCompositeFieldContainer[CreateTaskRateLimit]
|
|
198
|
+
worker_labels: _containers.MessageMap[str, DesiredWorkerLabels]
|
|
199
|
+
backoff_factor: float
|
|
200
|
+
backoff_max_seconds: int
|
|
201
|
+
concurrency: _containers.RepeatedCompositeFieldContainer[Concurrency]
|
|
202
|
+
conditions: _condition_pb2.TaskConditions
|
|
203
|
+
schedule_timeout: str
|
|
204
|
+
def __init__(self, readable_id: _Optional[str] = ..., action: _Optional[str] = ..., timeout: _Optional[str] = ..., inputs: _Optional[str] = ..., parents: _Optional[_Iterable[str]] = ..., retries: _Optional[int] = ..., rate_limits: _Optional[_Iterable[_Union[CreateTaskRateLimit, _Mapping]]] = ..., worker_labels: _Optional[_Mapping[str, DesiredWorkerLabels]] = ..., backoff_factor: _Optional[float] = ..., backoff_max_seconds: _Optional[int] = ..., concurrency: _Optional[_Iterable[_Union[Concurrency, _Mapping]]] = ..., conditions: _Optional[_Union[_condition_pb2.TaskConditions, _Mapping]] = ..., schedule_timeout: _Optional[str] = ...) -> None: ...
|
|
205
|
+
|
|
206
|
+
class CreateTaskRateLimit(_message.Message):
|
|
207
|
+
__slots__ = ("key", "units", "key_expr", "units_expr", "limit_values_expr", "duration")
|
|
208
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
209
|
+
UNITS_FIELD_NUMBER: _ClassVar[int]
|
|
210
|
+
KEY_EXPR_FIELD_NUMBER: _ClassVar[int]
|
|
211
|
+
UNITS_EXPR_FIELD_NUMBER: _ClassVar[int]
|
|
212
|
+
LIMIT_VALUES_EXPR_FIELD_NUMBER: _ClassVar[int]
|
|
213
|
+
DURATION_FIELD_NUMBER: _ClassVar[int]
|
|
214
|
+
key: str
|
|
215
|
+
units: int
|
|
216
|
+
key_expr: str
|
|
217
|
+
units_expr: str
|
|
218
|
+
limit_values_expr: str
|
|
219
|
+
duration: RateLimitDuration
|
|
220
|
+
def __init__(self, key: _Optional[str] = ..., units: _Optional[int] = ..., key_expr: _Optional[str] = ..., units_expr: _Optional[str] = ..., limit_values_expr: _Optional[str] = ..., duration: _Optional[_Union[RateLimitDuration, str]] = ...) -> None: ...
|
|
221
|
+
|
|
222
|
+
class CreateWorkflowVersionResponse(_message.Message):
|
|
223
|
+
__slots__ = ("id", "workflow_id")
|
|
224
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
225
|
+
WORKFLOW_ID_FIELD_NUMBER: _ClassVar[int]
|
|
226
|
+
id: str
|
|
227
|
+
workflow_id: str
|
|
228
|
+
def __init__(self, id: _Optional[str] = ..., workflow_id: _Optional[str] = ...) -> None: ...
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from hatchet_sdk.contracts.v1 import workflows_pb2 as v1_dot_workflows__pb2
|
|
7
|
+
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.64.1'
|
|
9
|
+
GRPC_VERSION = grpc.__version__
|
|
10
|
+
EXPECTED_ERROR_RELEASE = '1.65.0'
|
|
11
|
+
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
|
|
12
|
+
_version_not_supported = False
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from grpc._utilities import first_version_is_lower
|
|
16
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
17
|
+
except ImportError:
|
|
18
|
+
_version_not_supported = True
|
|
19
|
+
|
|
20
|
+
if _version_not_supported:
|
|
21
|
+
warnings.warn(
|
|
22
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
23
|
+
+ f' but the generated code in v1/workflows_pb2_grpc.py depends on'
|
|
24
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
25
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
26
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
27
|
+
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
|
|
28
|
+
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
|
|
29
|
+
RuntimeWarning
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AdminServiceStub(object):
|
|
34
|
+
"""AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(self, channel):
|
|
38
|
+
"""Constructor.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
channel: A grpc.Channel.
|
|
42
|
+
"""
|
|
43
|
+
self.PutWorkflow = channel.unary_unary(
|
|
44
|
+
'/v1.AdminService/PutWorkflow',
|
|
45
|
+
request_serializer=v1_dot_workflows__pb2.CreateWorkflowVersionRequest.SerializeToString,
|
|
46
|
+
response_deserializer=v1_dot_workflows__pb2.CreateWorkflowVersionResponse.FromString,
|
|
47
|
+
_registered_method=True)
|
|
48
|
+
self.CancelTasks = channel.unary_unary(
|
|
49
|
+
'/v1.AdminService/CancelTasks',
|
|
50
|
+
request_serializer=v1_dot_workflows__pb2.CancelTasksRequest.SerializeToString,
|
|
51
|
+
response_deserializer=v1_dot_workflows__pb2.CancelTasksResponse.FromString,
|
|
52
|
+
_registered_method=True)
|
|
53
|
+
self.ReplayTasks = channel.unary_unary(
|
|
54
|
+
'/v1.AdminService/ReplayTasks',
|
|
55
|
+
request_serializer=v1_dot_workflows__pb2.ReplayTasksRequest.SerializeToString,
|
|
56
|
+
response_deserializer=v1_dot_workflows__pb2.ReplayTasksResponse.FromString,
|
|
57
|
+
_registered_method=True)
|
|
58
|
+
self.TriggerWorkflowRun = channel.unary_unary(
|
|
59
|
+
'/v1.AdminService/TriggerWorkflowRun',
|
|
60
|
+
request_serializer=v1_dot_workflows__pb2.TriggerWorkflowRunRequest.SerializeToString,
|
|
61
|
+
response_deserializer=v1_dot_workflows__pb2.TriggerWorkflowRunResponse.FromString,
|
|
62
|
+
_registered_method=True)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class AdminServiceServicer(object):
|
|
66
|
+
"""AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
def PutWorkflow(self, request, context):
|
|
70
|
+
"""Missing associated documentation comment in .proto file."""
|
|
71
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
72
|
+
context.set_details('Method not implemented!')
|
|
73
|
+
raise NotImplementedError('Method not implemented!')
|
|
74
|
+
|
|
75
|
+
def CancelTasks(self, request, context):
|
|
76
|
+
"""Missing associated documentation comment in .proto file."""
|
|
77
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
78
|
+
context.set_details('Method not implemented!')
|
|
79
|
+
raise NotImplementedError('Method not implemented!')
|
|
80
|
+
|
|
81
|
+
def ReplayTasks(self, request, context):
|
|
82
|
+
"""Missing associated documentation comment in .proto file."""
|
|
83
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
84
|
+
context.set_details('Method not implemented!')
|
|
85
|
+
raise NotImplementedError('Method not implemented!')
|
|
86
|
+
|
|
87
|
+
def TriggerWorkflowRun(self, request, context):
|
|
88
|
+
"""Missing associated documentation comment in .proto file."""
|
|
89
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
90
|
+
context.set_details('Method not implemented!')
|
|
91
|
+
raise NotImplementedError('Method not implemented!')
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def add_AdminServiceServicer_to_server(servicer, server):
|
|
95
|
+
rpc_method_handlers = {
|
|
96
|
+
'PutWorkflow': grpc.unary_unary_rpc_method_handler(
|
|
97
|
+
servicer.PutWorkflow,
|
|
98
|
+
request_deserializer=v1_dot_workflows__pb2.CreateWorkflowVersionRequest.FromString,
|
|
99
|
+
response_serializer=v1_dot_workflows__pb2.CreateWorkflowVersionResponse.SerializeToString,
|
|
100
|
+
),
|
|
101
|
+
'CancelTasks': grpc.unary_unary_rpc_method_handler(
|
|
102
|
+
servicer.CancelTasks,
|
|
103
|
+
request_deserializer=v1_dot_workflows__pb2.CancelTasksRequest.FromString,
|
|
104
|
+
response_serializer=v1_dot_workflows__pb2.CancelTasksResponse.SerializeToString,
|
|
105
|
+
),
|
|
106
|
+
'ReplayTasks': grpc.unary_unary_rpc_method_handler(
|
|
107
|
+
servicer.ReplayTasks,
|
|
108
|
+
request_deserializer=v1_dot_workflows__pb2.ReplayTasksRequest.FromString,
|
|
109
|
+
response_serializer=v1_dot_workflows__pb2.ReplayTasksResponse.SerializeToString,
|
|
110
|
+
),
|
|
111
|
+
'TriggerWorkflowRun': grpc.unary_unary_rpc_method_handler(
|
|
112
|
+
servicer.TriggerWorkflowRun,
|
|
113
|
+
request_deserializer=v1_dot_workflows__pb2.TriggerWorkflowRunRequest.FromString,
|
|
114
|
+
response_serializer=v1_dot_workflows__pb2.TriggerWorkflowRunResponse.SerializeToString,
|
|
115
|
+
),
|
|
116
|
+
}
|
|
117
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
118
|
+
'v1.AdminService', rpc_method_handlers)
|
|
119
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
120
|
+
server.add_registered_method_handlers('v1.AdminService', rpc_method_handlers)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# This class is part of an EXPERIMENTAL API.
|
|
124
|
+
class AdminService(object):
|
|
125
|
+
"""AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
@staticmethod
|
|
129
|
+
def PutWorkflow(request,
|
|
130
|
+
target,
|
|
131
|
+
options=(),
|
|
132
|
+
channel_credentials=None,
|
|
133
|
+
call_credentials=None,
|
|
134
|
+
insecure=False,
|
|
135
|
+
compression=None,
|
|
136
|
+
wait_for_ready=None,
|
|
137
|
+
timeout=None,
|
|
138
|
+
metadata=None):
|
|
139
|
+
return grpc.experimental.unary_unary(
|
|
140
|
+
request,
|
|
141
|
+
target,
|
|
142
|
+
'/v1.AdminService/PutWorkflow',
|
|
143
|
+
v1_dot_workflows__pb2.CreateWorkflowVersionRequest.SerializeToString,
|
|
144
|
+
v1_dot_workflows__pb2.CreateWorkflowVersionResponse.FromString,
|
|
145
|
+
options,
|
|
146
|
+
channel_credentials,
|
|
147
|
+
insecure,
|
|
148
|
+
call_credentials,
|
|
149
|
+
compression,
|
|
150
|
+
wait_for_ready,
|
|
151
|
+
timeout,
|
|
152
|
+
metadata,
|
|
153
|
+
_registered_method=True)
|
|
154
|
+
|
|
155
|
+
@staticmethod
|
|
156
|
+
def CancelTasks(request,
|
|
157
|
+
target,
|
|
158
|
+
options=(),
|
|
159
|
+
channel_credentials=None,
|
|
160
|
+
call_credentials=None,
|
|
161
|
+
insecure=False,
|
|
162
|
+
compression=None,
|
|
163
|
+
wait_for_ready=None,
|
|
164
|
+
timeout=None,
|
|
165
|
+
metadata=None):
|
|
166
|
+
return grpc.experimental.unary_unary(
|
|
167
|
+
request,
|
|
168
|
+
target,
|
|
169
|
+
'/v1.AdminService/CancelTasks',
|
|
170
|
+
v1_dot_workflows__pb2.CancelTasksRequest.SerializeToString,
|
|
171
|
+
v1_dot_workflows__pb2.CancelTasksResponse.FromString,
|
|
172
|
+
options,
|
|
173
|
+
channel_credentials,
|
|
174
|
+
insecure,
|
|
175
|
+
call_credentials,
|
|
176
|
+
compression,
|
|
177
|
+
wait_for_ready,
|
|
178
|
+
timeout,
|
|
179
|
+
metadata,
|
|
180
|
+
_registered_method=True)
|
|
181
|
+
|
|
182
|
+
@staticmethod
|
|
183
|
+
def ReplayTasks(request,
|
|
184
|
+
target,
|
|
185
|
+
options=(),
|
|
186
|
+
channel_credentials=None,
|
|
187
|
+
call_credentials=None,
|
|
188
|
+
insecure=False,
|
|
189
|
+
compression=None,
|
|
190
|
+
wait_for_ready=None,
|
|
191
|
+
timeout=None,
|
|
192
|
+
metadata=None):
|
|
193
|
+
return grpc.experimental.unary_unary(
|
|
194
|
+
request,
|
|
195
|
+
target,
|
|
196
|
+
'/v1.AdminService/ReplayTasks',
|
|
197
|
+
v1_dot_workflows__pb2.ReplayTasksRequest.SerializeToString,
|
|
198
|
+
v1_dot_workflows__pb2.ReplayTasksResponse.FromString,
|
|
199
|
+
options,
|
|
200
|
+
channel_credentials,
|
|
201
|
+
insecure,
|
|
202
|
+
call_credentials,
|
|
203
|
+
compression,
|
|
204
|
+
wait_for_ready,
|
|
205
|
+
timeout,
|
|
206
|
+
metadata,
|
|
207
|
+
_registered_method=True)
|
|
208
|
+
|
|
209
|
+
@staticmethod
|
|
210
|
+
def TriggerWorkflowRun(request,
|
|
211
|
+
target,
|
|
212
|
+
options=(),
|
|
213
|
+
channel_credentials=None,
|
|
214
|
+
call_credentials=None,
|
|
215
|
+
insecure=False,
|
|
216
|
+
compression=None,
|
|
217
|
+
wait_for_ready=None,
|
|
218
|
+
timeout=None,
|
|
219
|
+
metadata=None):
|
|
220
|
+
return grpc.experimental.unary_unary(
|
|
221
|
+
request,
|
|
222
|
+
target,
|
|
223
|
+
'/v1.AdminService/TriggerWorkflowRun',
|
|
224
|
+
v1_dot_workflows__pb2.TriggerWorkflowRunRequest.SerializeToString,
|
|
225
|
+
v1_dot_workflows__pb2.TriggerWorkflowRunResponse.FromString,
|
|
226
|
+
options,
|
|
227
|
+
channel_credentials,
|
|
228
|
+
insecure,
|
|
229
|
+
call_credentials,
|
|
230
|
+
compression,
|
|
231
|
+
wait_for_ready,
|
|
232
|
+
timeout,
|
|
233
|
+
metadata,
|
|
234
|
+
_registered_method=True)
|
hatchet_sdk/features/cron.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from typing import Union
|
|
1
|
+
from typing import List, Union
|
|
2
2
|
|
|
3
|
-
from pydantic import BaseModel, field_validator
|
|
3
|
+
from pydantic import BaseModel, Field, field_validator
|
|
4
4
|
|
|
5
5
|
from hatchet_sdk.client import Client
|
|
6
6
|
from hatchet_sdk.clients.rest.models.cron_workflows import CronWorkflows
|
|
@@ -11,9 +11,10 @@ from hatchet_sdk.clients.rest.models.cron_workflows_order_by_field import (
|
|
|
11
11
|
from hatchet_sdk.clients.rest.models.workflow_run_order_by_direction import (
|
|
12
12
|
WorkflowRunOrderByDirection,
|
|
13
13
|
)
|
|
14
|
+
from hatchet_sdk.utils.typing import JSONSerializableMapping
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
class
|
|
17
|
+
class CreateCronTriggerConfig(BaseModel):
|
|
17
18
|
"""
|
|
18
19
|
Schema for creating a workflow run triggered by a cron.
|
|
19
20
|
|
|
@@ -23,12 +24,13 @@ class CreateCronTriggerInput(BaseModel):
|
|
|
23
24
|
additional_metadata (dict[str, str]): Additional metadata associated with the cron trigger (e.g. {"key1": "value1", "key2": "value2"}).
|
|
24
25
|
"""
|
|
25
26
|
|
|
26
|
-
expression: str
|
|
27
|
-
input:
|
|
28
|
-
additional_metadata:
|
|
27
|
+
expression: str
|
|
28
|
+
input: JSONSerializableMapping = Field(default_factory=dict)
|
|
29
|
+
additional_metadata: JSONSerializableMapping = Field(default_factory=dict)
|
|
29
30
|
|
|
30
31
|
@field_validator("expression")
|
|
31
|
-
|
|
32
|
+
@classmethod
|
|
33
|
+
def validate_cron_expression(cls, v: str) -> str:
|
|
32
34
|
"""
|
|
33
35
|
Validates the cron expression to ensure it adheres to the expected format.
|
|
34
36
|
|
|
@@ -79,15 +81,14 @@ class CronClient:
|
|
|
79
81
|
_client (Client): The client instance to be used for REST interactions.
|
|
80
82
|
"""
|
|
81
83
|
self._client = _client
|
|
82
|
-
self.aio = CronClientAsync(_client)
|
|
83
84
|
|
|
84
85
|
def create(
|
|
85
86
|
self,
|
|
86
87
|
workflow_name: str,
|
|
87
88
|
cron_name: str,
|
|
88
89
|
expression: str,
|
|
89
|
-
input:
|
|
90
|
-
additional_metadata:
|
|
90
|
+
input: JSONSerializableMapping,
|
|
91
|
+
additional_metadata: JSONSerializableMapping,
|
|
91
92
|
) -> CronWorkflows:
|
|
92
93
|
"""
|
|
93
94
|
Creates a new workflow cron trigger.
|
|
@@ -102,7 +103,7 @@ class CronClient:
|
|
|
102
103
|
Returns:
|
|
103
104
|
CronWorkflows: The created cron workflow instance.
|
|
104
105
|
"""
|
|
105
|
-
validated_input =
|
|
106
|
+
validated_input = CreateCronTriggerConfig(
|
|
106
107
|
expression=expression, input=input, additional_metadata=additional_metadata
|
|
107
108
|
)
|
|
108
109
|
|
|
@@ -121,10 +122,11 @@ class CronClient:
|
|
|
121
122
|
Args:
|
|
122
123
|
cron_trigger (Union[str, CronWorkflows]): The cron trigger ID or CronWorkflows instance to delete.
|
|
123
124
|
"""
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
self._client.rest.cron_delete(
|
|
126
|
+
cron_trigger.metadata.id
|
|
127
|
+
if isinstance(cron_trigger, CronWorkflows)
|
|
128
|
+
else cron_trigger
|
|
129
|
+
)
|
|
128
130
|
|
|
129
131
|
def list(
|
|
130
132
|
self,
|
|
@@ -168,38 +170,19 @@ class CronClient:
|
|
|
168
170
|
Returns:
|
|
169
171
|
CronWorkflows: The requested cron workflow instance.
|
|
170
172
|
"""
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
|
173
|
+
return self._client.rest.cron_get(
|
|
174
|
+
cron_trigger.metadata.id
|
|
175
|
+
if isinstance(cron_trigger, CronWorkflows)
|
|
176
|
+
else cron_trigger
|
|
177
|
+
)
|
|
195
178
|
|
|
196
|
-
async def
|
|
179
|
+
async def aio_create(
|
|
197
180
|
self,
|
|
198
181
|
workflow_name: str,
|
|
199
182
|
cron_name: str,
|
|
200
183
|
expression: str,
|
|
201
|
-
input:
|
|
202
|
-
additional_metadata:
|
|
184
|
+
input: JSONSerializableMapping,
|
|
185
|
+
additional_metadata: JSONSerializableMapping,
|
|
203
186
|
) -> CronWorkflows:
|
|
204
187
|
"""
|
|
205
188
|
Asynchronously creates a new workflow cron trigger.
|
|
@@ -214,11 +197,11 @@ class CronClientAsync:
|
|
|
214
197
|
Returns:
|
|
215
198
|
CronWorkflows: The created cron workflow instance.
|
|
216
199
|
"""
|
|
217
|
-
validated_input =
|
|
200
|
+
validated_input = CreateCronTriggerConfig(
|
|
218
201
|
expression=expression, input=input, additional_metadata=additional_metadata
|
|
219
202
|
)
|
|
220
203
|
|
|
221
|
-
return await self._client.rest.
|
|
204
|
+
return await self._client.rest.aio_create_cron(
|
|
222
205
|
workflow_name=workflow_name,
|
|
223
206
|
cron_name=cron_name,
|
|
224
207
|
expression=validated_input.expression,
|
|
@@ -226,24 +209,25 @@ class CronClientAsync:
|
|
|
226
209
|
additional_metadata=validated_input.additional_metadata,
|
|
227
210
|
)
|
|
228
211
|
|
|
229
|
-
async def
|
|
212
|
+
async def aio_delete(self, cron_trigger: Union[str, CronWorkflows]) -> None:
|
|
230
213
|
"""
|
|
231
214
|
Asynchronously deletes a workflow cron trigger.
|
|
232
215
|
|
|
233
216
|
Args:
|
|
234
217
|
cron_trigger (Union[str, CronWorkflows]): The cron trigger ID or CronWorkflows instance to delete.
|
|
235
218
|
"""
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
219
|
+
await self._client.rest.aio_delete_cron(
|
|
220
|
+
cron_trigger.metadata.id
|
|
221
|
+
if isinstance(cron_trigger, CronWorkflows)
|
|
222
|
+
else cron_trigger
|
|
223
|
+
)
|
|
240
224
|
|
|
241
|
-
async def
|
|
225
|
+
async def aio_list(
|
|
242
226
|
self,
|
|
243
227
|
offset: int | None = None,
|
|
244
228
|
limit: int | None = None,
|
|
245
229
|
workflow_id: str | None = None,
|
|
246
|
-
additional_metadata:
|
|
230
|
+
additional_metadata: List[str] | None = None,
|
|
247
231
|
order_by_field: CronWorkflowsOrderByField | None = None,
|
|
248
232
|
order_by_direction: WorkflowRunOrderByDirection | None = None,
|
|
249
233
|
) -> CronWorkflowsList:
|
|
@@ -261,7 +245,7 @@ class CronClientAsync:
|
|
|
261
245
|
Returns:
|
|
262
246
|
CronWorkflowsList: A list of cron workflows.
|
|
263
247
|
"""
|
|
264
|
-
return await self._client.rest.
|
|
248
|
+
return await self._client.rest.aio_list_crons(
|
|
265
249
|
offset=offset,
|
|
266
250
|
limit=limit,
|
|
267
251
|
workflow_id=workflow_id,
|
|
@@ -270,7 +254,7 @@ class CronClientAsync:
|
|
|
270
254
|
order_by_direction=order_by_direction,
|
|
271
255
|
)
|
|
272
256
|
|
|
273
|
-
async def
|
|
257
|
+
async def aio_get(self, cron_trigger: Union[str, CronWorkflows]) -> CronWorkflows:
|
|
274
258
|
"""
|
|
275
259
|
Asynchronously retrieves a specific workflow cron trigger by ID.
|
|
276
260
|
|
|
@@ -280,7 +264,9 @@ class CronClientAsync:
|
|
|
280
264
|
Returns:
|
|
281
265
|
CronWorkflows: The requested cron workflow instance.
|
|
282
266
|
"""
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
267
|
+
|
|
268
|
+
return await self._client.rest.aio_get_cron(
|
|
269
|
+
cron_trigger.metadata.id
|
|
270
|
+
if isinstance(cron_trigger, CronWorkflows)
|
|
271
|
+
else cron_trigger
|
|
272
|
+
)
|