plato-sdk-v2 2.0.7__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.
- plato/__init__.py +28 -0
- plato/_generated/__init__.py +37 -0
- plato/_generated/api/__init__.py +8 -0
- plato/_generated/api/v1/__init__.py +31 -0
- plato/_generated/api/v1/agent_artifacts/__init__.py +10 -0
- plato/_generated/api/v1/agent_artifacts/archive_agent_artifact.py +68 -0
- plato/_generated/api/v1/agent_artifacts/create_agent_artifact.py +70 -0
- plato/_generated/api/v1/agent_artifacts/get_agent_artifact_by_public_id.py +68 -0
- plato/_generated/api/v1/agent_artifacts/get_agent_artifacts.py +63 -0
- plato/_generated/api/v1/cluster/__init__.py +21 -0
- plato/_generated/api/v1/cluster/cleanup_stale_vms.py +87 -0
- plato/_generated/api/v1/cluster/get_dispatchers.py +50 -0
- plato/_generated/api/v1/cluster/get_nodes_status.py +62 -0
- plato/_generated/api/v1/cluster/get_snapshot_lineage.py +78 -0
- plato/_generated/api/v1/cluster/get_snapshots_status.py +62 -0
- plato/_generated/api/v1/cluster/pause_resume_dispatchers.py +93 -0
- plato/_generated/api/v1/cluster/prefetch_snapshot.py +104 -0
- plato/_generated/api/v1/env/__init__.py +67 -0
- plato/_generated/api/v1/env/backup.py +69 -0
- plato/_generated/api/v1/env/cleanup.py +69 -0
- plato/_generated/api/v1/env/close.py +69 -0
- plato/_generated/api/v1/env/close_async.py +69 -0
- plato/_generated/api/v1/env/create.py +70 -0
- plato/_generated/api/v1/env/create_batch.py +78 -0
- plato/_generated/api/v1/env/create_simulator.py +70 -0
- plato/_generated/api/v1/env/evaluate_session.py +69 -0
- plato/_generated/api/v1/env/generate_mutations.py +53 -0
- plato/_generated/api/v1/env/generate_mutations_single.py +53 -0
- plato/_generated/api/v1/env/get_active_session.py +69 -0
- plato/_generated/api/v1/env/get_app_sim_worker_info.py +52 -0
- plato/_generated/api/v1/env/get_cdp_url.py +69 -0
- plato/_generated/api/v1/env/get_flows.py +69 -0
- plato/_generated/api/v1/env/get_interface_worker_info.py +69 -0
- plato/_generated/api/v1/env/get_job_info.py +69 -0
- plato/_generated/api/v1/env/get_job_status.py +69 -0
- plato/_generated/api/v1/env/get_job_worker_info.py +52 -0
- plato/_generated/api/v1/env/get_proxy_url.py +69 -0
- plato/_generated/api/v1/env/get_public_url.py +99 -0
- plato/_generated/api/v1/env/get_simulator_by_name.py +69 -0
- plato/_generated/api/v1/env/get_simulators.py +64 -0
- plato/_generated/api/v1/env/get_state.py +69 -0
- plato/_generated/api/v1/env/get_worker_ready.py +87 -0
- plato/_generated/api/v1/env/log_state_mutation.py +52 -0
- plato/_generated/api/v1/env/rescore_simulator_sessions.py +69 -0
- plato/_generated/api/v1/env/reset.py +75 -0
- plato/_generated/api/v1/env/score.py +75 -0
- plato/_generated/api/v1/env/send_heartbeat.py +69 -0
- plato/_generated/api/v1/env/update_simulator.py +75 -0
- plato/_generated/api/v1/evals/__init__.py +11 -0
- plato/_generated/api/v1/evals/evaluate_python.py +70 -0
- plato/_generated/api/v1/evals/get_scores_by_user.py +101 -0
- plato/_generated/api/v1/evals/get_scoring.py +51 -0
- plato/_generated/api/v1/evals/human_in_the_loop_scoring.py +75 -0
- plato/_generated/api/v1/evals/start_eval_from_git.py +70 -0
- plato/_generated/api/v1/gitea/__init__.py +35 -0
- plato/_generated/api/v1/gitea/create_gitea_repository.py +70 -0
- plato/_generated/api/v1/gitea/create_simulator_repository.py +76 -0
- plato/_generated/api/v1/gitea/delete_gitea_repository.py +74 -0
- plato/_generated/api/v1/gitea/get_accessible_simulators.py +71 -0
- plato/_generated/api/v1/gitea/get_gitea_credentials.py +64 -0
- plato/_generated/api/v1/gitea/get_gitea_repository.py +74 -0
- plato/_generated/api/v1/gitea/get_my_gitea_info.py +64 -0
- plato/_generated/api/v1/gitea/get_my_repositories.py +64 -0
- plato/_generated/api/v1/gitea/get_repository_branches.py +73 -0
- plato/_generated/api/v1/gitea/get_repository_contents.py +90 -0
- plato/_generated/api/v1/gitea/get_simulator_file_content.py +93 -0
- plato/_generated/api/v1/gitea/get_simulator_repository.py +76 -0
- plato/_generated/api/v1/gitea/get_simulator_repository_branches.py +75 -0
- plato/_generated/api/v1/gitea/get_simulator_repository_contents.py +92 -0
- plato/_generated/api/v1/jobs/__init__.py +11 -0
- plato/_generated/api/v1/jobs/get_job_by_id.py +75 -0
- plato/_generated/api/v1/jobs/get_jobs_by_group_id.py +75 -0
- plato/_generated/api/v1/jobs/get_keepalive_jobs.py +63 -0
- plato/_generated/api/v1/jobs/list_jobs.py +109 -0
- plato/_generated/api/v1/jobs/update_job_status.py +77 -0
- plato/_generated/api/v1/organization/__init__.py +33 -0
- plato/_generated/api/v1/organization/create_annotator_assignment.py +70 -0
- plato/_generated/api/v1/organization/create_org_api_key.py +75 -0
- plato/_generated/api/v1/organization/create_org_policy.py +75 -0
- plato/_generated/api/v1/organization/delete_org_api_key.py +73 -0
- plato/_generated/api/v1/organization/delete_org_policy.py +73 -0
- plato/_generated/api/v1/organization/get_annotator_assignments.py +74 -0
- plato/_generated/api/v1/organization/get_org_api_key_policies.py +74 -0
- plato/_generated/api/v1/organization/get_org_api_keys.py +69 -0
- plato/_generated/api/v1/organization/get_org_policies.py +69 -0
- plato/_generated/api/v1/organization/get_organization_concurrency_status.py +85 -0
- plato/_generated/api/v1/organization/get_organization_members.py +63 -0
- plato/_generated/api/v1/organization/update_annotator_assignment_stage.py +81 -0
- plato/_generated/api/v1/organization/update_organization_concurrency_limit.py +89 -0
- plato/_generated/api/v1/queue/__init__.py +10 -0
- plato/_generated/api/v1/queue/get_queue_status.py +56 -0
- plato/_generated/api/v1/queue/get_vm_detail.py +83 -0
- plato/_generated/api/v1/queue/get_vms.py +96 -0
- plato/_generated/api/v1/queue/get_workers.py +87 -0
- plato/_generated/api/v1/sandbox/__init__.py +29 -0
- plato/_generated/api/v1/sandbox/checkpoint_vm.py +81 -0
- plato/_generated/api/v1/sandbox/close_vm.py +69 -0
- plato/_generated/api/v1/sandbox/create_vm.py +70 -0
- plato/_generated/api/v1/sandbox/execute_ssh_command.py +81 -0
- plato/_generated/api/v1/sandbox/get_operation_events.py +68 -0
- plato/_generated/api/v1/sandbox/healthy_services.py +75 -0
- plato/_generated/api/v1/sandbox/healthy_worker.py +69 -0
- plato/_generated/api/v1/sandbox/save_vm_snapshot.py +79 -0
- plato/_generated/api/v1/sandbox/setup_root_access.py +75 -0
- plato/_generated/api/v1/sandbox/setup_sandbox.py +75 -0
- plato/_generated/api/v1/sandbox/start_worker.py +75 -0
- plato/_generated/api/v1/session/__init__.py +53 -0
- plato/_generated/api/v1/session/analyze_labels.py +68 -0
- plato/_generated/api/v1/session/archive_session.py +68 -0
- plato/_generated/api/v1/session/create_from_labels.py +75 -0
- plato/_generated/api/v1/session/create_session_from_browser.py +70 -0
- plato/_generated/api/v1/session/create_session_from_env_recording.py +63 -0
- plato/_generated/api/v1/session/create_session_from_har.py +63 -0
- plato/_generated/api/v1/session/get_env_recording.py +68 -0
- plato/_generated/api/v1/session/get_grouped_replay_sessions.py +63 -0
- plato/_generated/api/v1/session/get_network_requests.py +68 -0
- plato/_generated/api/v1/session/get_next_session_for_annotator.py +73 -0
- plato/_generated/api/v1/session/get_public_benchmark_sessions.py +72 -0
- plato/_generated/api/v1/session/get_replay_score_data.py +68 -0
- plato/_generated/api/v1/session/get_rrweb_actions.py +68 -0
- plato/_generated/api/v1/session/get_rrweb_events.py +68 -0
- plato/_generated/api/v1/session/get_screen_recording.py +68 -0
- plato/_generated/api/v1/session/get_session.py +78 -0
- plato/_generated/api/v1/session/get_session_replays.py +68 -0
- plato/_generated/api/v1/session/get_sessions.py +63 -0
- plato/_generated/api/v1/session/get_ui_events.py +68 -0
- plato/_generated/api/v1/session/score_session_with_config.py +75 -0
- plato/_generated/api/v1/session/search_sessions_by_ids.py +73 -0
- plato/_generated/api/v1/session/update_session_public.py +75 -0
- plato/_generated/api/v1/session/update_session_testcase.py +75 -0
- plato/_generated/api/v1/simulator/__init__.py +53 -0
- plato/_generated/api/v1/simulator/add_simulator_review.py +81 -0
- plato/_generated/api/v1/simulator/batch_create_test_cases.py +75 -0
- plato/_generated/api/v1/simulator/batch_get_artifact_metadata.py +53 -0
- plato/_generated/api/v1/simulator/get_all_simulators_info.py +74 -0
- plato/_generated/api/v1/simulator/get_db_config.py +75 -0
- plato/_generated/api/v1/simulator/get_env_flows.py +68 -0
- plato/_generated/api/v1/simulator/get_plato_config.py +69 -0
- plato/_generated/api/v1/simulator/get_sessions_batch_by_job_groups.py +81 -0
- plato/_generated/api/v1/simulator/get_sessions_by_job_group.py +86 -0
- plato/_generated/api/v1/simulator/get_simulator_by_name.py +82 -0
- plato/_generated/api/v1/simulator/get_simulator_id.py +69 -0
- plato/_generated/api/v1/simulator/get_simulator_info.py +67 -0
- plato/_generated/api/v1/simulator/get_simulator_version_details.py +62 -0
- plato/_generated/api/v1/simulator/get_simulator_versions.py +79 -0
- plato/_generated/api/v1/simulator/get_start_path.py +82 -0
- plato/_generated/api/v1/simulator/get_version_by_tag.py +55 -0
- plato/_generated/api/v1/simulator/list_simulators.py +64 -0
- plato/_generated/api/v1/simulator/list_simulators_by_org.py +64 -0
- plato/_generated/api/v1/simulator/list_simulators_status.py +64 -0
- plato/_generated/api/v1/simulator/register.py +75 -0
- plato/_generated/api/v1/simulator/update_simulator.py +75 -0
- plato/_generated/api/v1/simulator/update_simulator_status.py +85 -0
- plato/_generated/api/v1/simulator/update_tag.py +72 -0
- plato/_generated/api/v1/testcases/__init__.py +59 -0
- plato/_generated/api/v1/testcases/archive_organization_test_case_assignments.py +72 -0
- plato/_generated/api/v1/testcases/archive_organization_testcase.py +70 -0
- plato/_generated/api/v1/testcases/archive_testcase.py +68 -0
- plato/_generated/api/v1/testcases/assign_testcase_to_organizations.py +75 -0
- plato/_generated/api/v1/testcases/bulk_archive_testcases.py +70 -0
- plato/_generated/api/v1/testcases/convert_text_to_structured_data.py +70 -0
- plato/_generated/api/v1/testcases/create_testcase.py +70 -0
- plato/_generated/api/v1/testcases/create_testcase_set.py +70 -0
- plato/_generated/api/v1/testcases/delete_testcase_set.py +51 -0
- plato/_generated/api/v1/testcases/filter_human_recorder_testcases.py +101 -0
- plato/_generated/api/v1/testcases/generate_outcome_schema.py +53 -0
- plato/_generated/api/v1/testcases/generate_prediction.py +53 -0
- plato/_generated/api/v1/testcases/generate_prediction_from_steps.py +53 -0
- plato/_generated/api/v1/testcases/generate_scoring_config_from_sessions.py +70 -0
- plato/_generated/api/v1/testcases/generate_state_mutations_config_route.py +51 -0
- plato/_generated/api/v1/testcases/get_human_recorder_tab_counts.py +94 -0
- plato/_generated/api/v1/testcases/get_human_recorder_testcases.py +101 -0
- plato/_generated/api/v1/testcases/get_merged_mutations.py +70 -0
- plato/_generated/api/v1/testcases/get_organization_test_case_assignments.py +96 -0
- plato/_generated/api/v1/testcases/get_testcase.py +51 -0
- plato/_generated/api/v1/testcases/get_testcase_sets.py +63 -0
- plato/_generated/api/v1/testcases/get_testcases.py +171 -0
- plato/_generated/api/v1/testcases/get_testcases_in_set.py +68 -0
- plato/_generated/api/v1/testcases/mark_organization_test_case_completed.py +68 -0
- plato/_generated/api/v1/testcases/update_testcase.py +75 -0
- plato/_generated/api/v1/testcases/version_bump_testcase.py +75 -0
- plato/_generated/api/v2/__init__.py +9 -0
- plato/_generated/api/v2/chronos_packages/__init__.py +10 -0
- plato/_generated/api/v2/chronos_packages/get_package_versions.py +89 -0
- plato/_generated/api/v2/chronos_packages/list_chronos_packages.py +76 -0
- plato/_generated/api/v2/chronos_packages/register_chronos_package.py +102 -0
- plato/_generated/api/v2/chronos_packages/upload_chronos_package.py +106 -0
- plato/_generated/api/v2/interfaces/__init__.py +27 -0
- plato/_generated/api/v2/interfaces/v2_interface_browser_create.py +68 -0
- plato/_generated/api/v2/interfaces/v2_interface_cdp_url.py +65 -0
- plato/_generated/api/v2/interfaces/v2_interface_click.py +64 -0
- plato/_generated/api/v2/interfaces/v2_interface_close.py +59 -0
- plato/_generated/api/v2/interfaces/v2_interface_computer_create.py +68 -0
- plato/_generated/api/v2/interfaces/v2_interface_cursor.py +64 -0
- plato/_generated/api/v2/interfaces/v2_interface_key.py +68 -0
- plato/_generated/api/v2/interfaces/v2_interface_screenshot.py +65 -0
- plato/_generated/api/v2/interfaces/v2_interface_scroll.py +70 -0
- plato/_generated/api/v2/interfaces/v2_interface_type.py +64 -0
- plato/_generated/api/v2/jobs/__init__.py +27 -0
- plato/_generated/api/v2/jobs/close.py +69 -0
- plato/_generated/api/v2/jobs/connect_routing_info.py +74 -0
- plato/_generated/api/v2/jobs/connect_url.py +105 -0
- plato/_generated/api/v2/jobs/execute.py +75 -0
- plato/_generated/api/v2/jobs/make.py +78 -0
- plato/_generated/api/v2/jobs/public_url.py +107 -0
- plato/_generated/api/v2/jobs/reset.py +75 -0
- plato/_generated/api/v2/jobs/snapshot.py +69 -0
- plato/_generated/api/v2/jobs/state.py +69 -0
- plato/_generated/api/v2/jobs/wait_for_ready.py +105 -0
- plato/_generated/api/v2/sessions/__init__.py +33 -0
- plato/_generated/api/v2/sessions/checkpoint.py +81 -0
- plato/_generated/api/v2/sessions/close.py +69 -0
- plato/_generated/api/v2/sessions/evaluate.py +69 -0
- plato/_generated/api/v2/sessions/execute.py +75 -0
- plato/_generated/api/v2/sessions/get_connect_url.py +99 -0
- plato/_generated/api/v2/sessions/get_public_url.py +101 -0
- plato/_generated/api/v2/sessions/heartbeat.py +69 -0
- plato/_generated/api/v2/sessions/list_jobs.py +69 -0
- plato/_generated/api/v2/sessions/make.py +78 -0
- plato/_generated/api/v2/sessions/reset.py +75 -0
- plato/_generated/api/v2/sessions/snapshot.py +69 -0
- plato/_generated/api/v2/sessions/state.py +87 -0
- plato/_generated/api/v2/sessions/wait_for_ready.py +107 -0
- plato/_generated/api/version/__init__.py +7 -0
- plato/_generated/api/version/check.py +43 -0
- plato/_generated/client.py +171 -0
- plato/_generated/errors.py +141 -0
- plato/_generated/models/__init__.py +2267 -0
- plato/_generated/py.typed +0 -0
- plato/py.typed +0 -0
- plato/v1/__init__.py +6 -0
- plato/v1/audit_ui.py +281 -0
- plato/v1/cli.py +1370 -0
- plato/v1/config.py +25 -0
- plato/v1/examples/doordash_tasks.py +540 -0
- plato/v1/examples/loadtest.py +160 -0
- plato/v1/examples/test_env.py +128 -0
- plato/v1/examples/test_env_custom_browser.py +103 -0
- plato/v1/examples/test_env_sync.py +80 -0
- plato/v1/examples/test_reuse_env.py +0 -0
- plato/v1/examples/test_run.py +0 -0
- plato/v1/exceptions.py +4 -0
- plato/v1/extensions/envgen-recorder/README.md +223 -0
- plato/v1/extensions/envgen-recorder/api-client.js +158 -0
- plato/v1/extensions/envgen-recorder/background.js +1044 -0
- plato/v1/extensions/envgen-recorder/build-sdk.js +17 -0
- plato/v1/extensions/envgen-recorder/content.js +446 -0
- plato/v1/extensions/envgen-recorder/manifest.json +51 -0
- plato/v1/extensions/envgen-recorder/offscreen.html +10 -0
- plato/v1/extensions/envgen-recorder/offscreen.js +205 -0
- plato/v1/extensions/envgen-recorder/options.html +204 -0
- plato/v1/extensions/envgen-recorder/options.js +101 -0
- plato/v1/extensions/envgen-recorder/package-lock.json +496 -0
- plato/v1/extensions/envgen-recorder/package.json +5 -0
- plato/v1/extensions/envgen-recorder/plato-sdk-bundle.js +7036 -0
- plato/v1/extensions/envgen-recorder/plato-sdk-bundle.js.map +7 -0
- plato/v1/extensions/envgen-recorder/popup.html +228 -0
- plato/v1/extensions/envgen-recorder/popup.js +324 -0
- plato/v1/extensions/envgen-recorder/review-panel.html +63 -0
- plato/v1/extensions/envgen-recorder/review-panel.js +216 -0
- plato/v1/extensions/envgen-recorder/review-success.html +49 -0
- plato/v1/extensions/envgen-recorder/review-success.js +58 -0
- plato/v1/extensions/envgen-recorder/session-active.html +63 -0
- plato/v1/extensions/envgen-recorder/session-active.js +487 -0
- plato/v1/extensions/envgen-recorder/session-ended.html +54 -0
- plato/v1/extensions/envgen-recorder/session-ended.js +61 -0
- plato/v1/extensions/envgen-recorder/session-setup.html +54 -0
- plato/v1/extensions/envgen-recorder/session-setup.js +101 -0
- plato/v1/extensions/envgen-recorder/sessions.html +270 -0
- plato/v1/extensions/envgen-recorder/sessions.js +444 -0
- plato/v1/extensions/envgen-recorder/styles.css +374 -0
- plato/v1/flow_executor.py +459 -0
- plato/v1/models/__init__.py +37 -0
- plato/v1/models/build_models.py +245 -0
- plato/v1/models/env.py +775 -0
- plato/v1/models/flow.py +195 -0
- plato/v1/models/sandbox.py +143 -0
- plato/v1/models/task.py +145 -0
- plato/v1/sandbox_sdk.py +1046 -0
- plato/v1/sdk.py +852 -0
- plato/v1/sync_env.py +604 -0
- plato/v1/sync_flow_executor.py +453 -0
- plato/v1/sync_sdk.py +689 -0
- plato/v1/utils/proxytunnel.py +152 -0
- plato/v2/__init__.py +47 -0
- plato/v2/async_/__init__.py +11 -0
- plato/v2/async_/client.py +127 -0
- plato/v2/async_/environment.py +117 -0
- plato/v2/async_/session.py +797 -0
- plato/v2/models.py +61 -0
- plato/v2/sync/__init__.py +11 -0
- plato/v2/sync/client.py +127 -0
- plato/v2/sync/environment.py +117 -0
- plato/v2/sync/session.py +563 -0
- plato/v2/types.py +125 -0
- plato/v2/utils/__init__.py +1 -0
- plato/v2/utils/db_cleanup.py +226 -0
- plato/v2/utils/models.py +54 -0
- plato/v2/utils/proxy_tunnel.py +301 -0
- plato_sdk_v2-2.0.7.dist-info/METADATA +228 -0
- plato_sdk_v2-2.0.7.dist-info/RECORD +303 -0
- plato_sdk_v2-2.0.7.dist-info/WHEEL +4 -0
- plato_sdk_v2-2.0.7.dist-info/entry_points.txt +2 -0
plato/__init__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Plato SDK
|
|
2
|
+
#
|
|
3
|
+
# v1: Legacy SDK (deprecated)
|
|
4
|
+
# v2: New SDK with separate sync/async modules
|
|
5
|
+
#
|
|
6
|
+
# Usage (v2 - recommended):
|
|
7
|
+
# from plato.v2 import AsyncPlato, Plato, Env
|
|
8
|
+
#
|
|
9
|
+
# Usage (v1 - deprecated):
|
|
10
|
+
# from plato import Plato, SyncPlato
|
|
11
|
+
|
|
12
|
+
from plato import v2 as v2
|
|
13
|
+
|
|
14
|
+
__all__ = ["v2"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __getattr__(name: str):
|
|
18
|
+
"""Lazy import to avoid loading all modules at once."""
|
|
19
|
+
if name in ("Plato", "SyncPlato", "PlatoTask", "v1"):
|
|
20
|
+
try:
|
|
21
|
+
from plato import v1
|
|
22
|
+
|
|
23
|
+
if name == "v1":
|
|
24
|
+
return v1
|
|
25
|
+
return getattr(v1, name)
|
|
26
|
+
except ImportError:
|
|
27
|
+
raise AttributeError(f"module 'plato' has no attribute '{name}' (v1 unavailable)")
|
|
28
|
+
raise AttributeError(f"module 'plato' has no attribute '{name}'")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Plato API SDK - v0.14.0"""
|
|
2
|
+
|
|
3
|
+
from . import api, errors, models
|
|
4
|
+
from .client import AsyncClient, Client
|
|
5
|
+
from .errors import (
|
|
6
|
+
APIError,
|
|
7
|
+
BadRequestError,
|
|
8
|
+
ConflictError,
|
|
9
|
+
ForbiddenError,
|
|
10
|
+
InternalServerError,
|
|
11
|
+
NotFoundError,
|
|
12
|
+
RateLimitError,
|
|
13
|
+
ServiceUnavailableError,
|
|
14
|
+
UnauthorizedError,
|
|
15
|
+
UnprocessableEntityError,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
# Clients
|
|
20
|
+
"Client",
|
|
21
|
+
"AsyncClient",
|
|
22
|
+
# Modules
|
|
23
|
+
"api",
|
|
24
|
+
"models",
|
|
25
|
+
"errors",
|
|
26
|
+
# Error types for convenience
|
|
27
|
+
"APIError",
|
|
28
|
+
"BadRequestError",
|
|
29
|
+
"UnauthorizedError",
|
|
30
|
+
"ForbiddenError",
|
|
31
|
+
"NotFoundError",
|
|
32
|
+
"ConflictError",
|
|
33
|
+
"UnprocessableEntityError",
|
|
34
|
+
"RateLimitError",
|
|
35
|
+
"InternalServerError",
|
|
36
|
+
"ServiceUnavailableError",
|
|
37
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""API version module."""
|
|
2
|
+
|
|
3
|
+
from . import (
|
|
4
|
+
agent_artifacts,
|
|
5
|
+
cluster,
|
|
6
|
+
env,
|
|
7
|
+
evals,
|
|
8
|
+
gitea,
|
|
9
|
+
jobs,
|
|
10
|
+
organization,
|
|
11
|
+
queue,
|
|
12
|
+
sandbox,
|
|
13
|
+
session,
|
|
14
|
+
simulator,
|
|
15
|
+
testcases,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"agent_artifacts",
|
|
20
|
+
"cluster",
|
|
21
|
+
"env",
|
|
22
|
+
"evals",
|
|
23
|
+
"gitea",
|
|
24
|
+
"jobs",
|
|
25
|
+
"organization",
|
|
26
|
+
"queue",
|
|
27
|
+
"sandbox",
|
|
28
|
+
"session",
|
|
29
|
+
"simulator",
|
|
30
|
+
"testcases",
|
|
31
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""API endpoints."""
|
|
2
|
+
|
|
3
|
+
from . import archive_agent_artifact, create_agent_artifact, get_agent_artifact_by_public_id, get_agent_artifacts
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"get_agent_artifacts",
|
|
7
|
+
"create_agent_artifact",
|
|
8
|
+
"get_agent_artifact_by_public_id",
|
|
9
|
+
"archive_agent_artifact",
|
|
10
|
+
]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Archive Agent Artifact"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _build_request_args(
|
|
13
|
+
artifact_id: str,
|
|
14
|
+
authorization: str | None = None,
|
|
15
|
+
x_api_key: str | None = None,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
"""Build request arguments."""
|
|
18
|
+
url = f"/api/v1/agent-artifacts/{artifact_id}"
|
|
19
|
+
|
|
20
|
+
headers: dict[str, str] = {}
|
|
21
|
+
if authorization is not None:
|
|
22
|
+
headers["authorization"] = authorization
|
|
23
|
+
if x_api_key is not None:
|
|
24
|
+
headers["X-API-Key"] = x_api_key
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
"method": "DELETE",
|
|
28
|
+
"url": url,
|
|
29
|
+
"headers": headers,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def sync(
|
|
34
|
+
client: httpx.Client,
|
|
35
|
+
artifact_id: str,
|
|
36
|
+
authorization: str | None = None,
|
|
37
|
+
x_api_key: str | None = None,
|
|
38
|
+
) -> Any:
|
|
39
|
+
"""Archive Agent Artifact"""
|
|
40
|
+
|
|
41
|
+
request_args = _build_request_args(
|
|
42
|
+
artifact_id=artifact_id,
|
|
43
|
+
authorization=authorization,
|
|
44
|
+
x_api_key=x_api_key,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
response = client.request(**request_args)
|
|
48
|
+
raise_for_status(response)
|
|
49
|
+
return response.json()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def asyncio(
|
|
53
|
+
client: httpx.AsyncClient,
|
|
54
|
+
artifact_id: str,
|
|
55
|
+
authorization: str | None = None,
|
|
56
|
+
x_api_key: str | None = None,
|
|
57
|
+
) -> Any:
|
|
58
|
+
"""Archive Agent Artifact"""
|
|
59
|
+
|
|
60
|
+
request_args = _build_request_args(
|
|
61
|
+
artifact_id=artifact_id,
|
|
62
|
+
authorization=authorization,
|
|
63
|
+
x_api_key=x_api_key,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
response = await client.request(**request_args)
|
|
67
|
+
raise_for_status(response)
|
|
68
|
+
return response.json()
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Create Agent Artifact"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
from plato._generated.models import CreateAgentArtifactRequest
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _build_request_args(
|
|
14
|
+
body: CreateAgentArtifactRequest,
|
|
15
|
+
authorization: str | None = None,
|
|
16
|
+
x_api_key: str | None = None,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
"""Build request arguments."""
|
|
19
|
+
url = "/api/v1/agent-artifacts/"
|
|
20
|
+
|
|
21
|
+
headers: dict[str, str] = {}
|
|
22
|
+
if authorization is not None:
|
|
23
|
+
headers["authorization"] = authorization
|
|
24
|
+
if x_api_key is not None:
|
|
25
|
+
headers["X-API-Key"] = x_api_key
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
"method": "POST",
|
|
29
|
+
"url": url,
|
|
30
|
+
"json": body.model_dump(mode="json", exclude_none=True),
|
|
31
|
+
"headers": headers,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def sync(
|
|
36
|
+
client: httpx.Client,
|
|
37
|
+
body: CreateAgentArtifactRequest,
|
|
38
|
+
authorization: str | None = None,
|
|
39
|
+
x_api_key: str | None = None,
|
|
40
|
+
) -> Any:
|
|
41
|
+
"""Create Agent Artifact"""
|
|
42
|
+
|
|
43
|
+
request_args = _build_request_args(
|
|
44
|
+
body=body,
|
|
45
|
+
authorization=authorization,
|
|
46
|
+
x_api_key=x_api_key,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
response = client.request(**request_args)
|
|
50
|
+
raise_for_status(response)
|
|
51
|
+
return response.json()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async def asyncio(
|
|
55
|
+
client: httpx.AsyncClient,
|
|
56
|
+
body: CreateAgentArtifactRequest,
|
|
57
|
+
authorization: str | None = None,
|
|
58
|
+
x_api_key: str | None = None,
|
|
59
|
+
) -> Any:
|
|
60
|
+
"""Create Agent Artifact"""
|
|
61
|
+
|
|
62
|
+
request_args = _build_request_args(
|
|
63
|
+
body=body,
|
|
64
|
+
authorization=authorization,
|
|
65
|
+
x_api_key=x_api_key,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
response = await client.request(**request_args)
|
|
69
|
+
raise_for_status(response)
|
|
70
|
+
return response.json()
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Get Agent Artifact By Public Id"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _build_request_args(
|
|
13
|
+
public_id: str,
|
|
14
|
+
authorization: str | None = None,
|
|
15
|
+
x_api_key: str | None = None,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
"""Build request arguments."""
|
|
18
|
+
url = f"/api/v1/agent-artifacts/{public_id}"
|
|
19
|
+
|
|
20
|
+
headers: dict[str, str] = {}
|
|
21
|
+
if authorization is not None:
|
|
22
|
+
headers["authorization"] = authorization
|
|
23
|
+
if x_api_key is not None:
|
|
24
|
+
headers["X-API-Key"] = x_api_key
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
"method": "GET",
|
|
28
|
+
"url": url,
|
|
29
|
+
"headers": headers,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def sync(
|
|
34
|
+
client: httpx.Client,
|
|
35
|
+
public_id: str,
|
|
36
|
+
authorization: str | None = None,
|
|
37
|
+
x_api_key: str | None = None,
|
|
38
|
+
) -> Any:
|
|
39
|
+
"""Get Agent Artifact By Public Id"""
|
|
40
|
+
|
|
41
|
+
request_args = _build_request_args(
|
|
42
|
+
public_id=public_id,
|
|
43
|
+
authorization=authorization,
|
|
44
|
+
x_api_key=x_api_key,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
response = client.request(**request_args)
|
|
48
|
+
raise_for_status(response)
|
|
49
|
+
return response.json()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def asyncio(
|
|
53
|
+
client: httpx.AsyncClient,
|
|
54
|
+
public_id: str,
|
|
55
|
+
authorization: str | None = None,
|
|
56
|
+
x_api_key: str | None = None,
|
|
57
|
+
) -> Any:
|
|
58
|
+
"""Get Agent Artifact By Public Id"""
|
|
59
|
+
|
|
60
|
+
request_args = _build_request_args(
|
|
61
|
+
public_id=public_id,
|
|
62
|
+
authorization=authorization,
|
|
63
|
+
x_api_key=x_api_key,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
response = await client.request(**request_args)
|
|
67
|
+
raise_for_status(response)
|
|
68
|
+
return response.json()
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Get Agent Artifacts"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _build_request_args(
|
|
13
|
+
authorization: str | None = None,
|
|
14
|
+
x_api_key: str | None = None,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
"""Build request arguments."""
|
|
17
|
+
url = "/api/v1/agent-artifacts/"
|
|
18
|
+
|
|
19
|
+
headers: dict[str, str] = {}
|
|
20
|
+
if authorization is not None:
|
|
21
|
+
headers["authorization"] = authorization
|
|
22
|
+
if x_api_key is not None:
|
|
23
|
+
headers["X-API-Key"] = x_api_key
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
"method": "GET",
|
|
27
|
+
"url": url,
|
|
28
|
+
"headers": headers,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def sync(
|
|
33
|
+
client: httpx.Client,
|
|
34
|
+
authorization: str | None = None,
|
|
35
|
+
x_api_key: str | None = None,
|
|
36
|
+
) -> Any:
|
|
37
|
+
"""Get Agent Artifacts"""
|
|
38
|
+
|
|
39
|
+
request_args = _build_request_args(
|
|
40
|
+
authorization=authorization,
|
|
41
|
+
x_api_key=x_api_key,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
response = client.request(**request_args)
|
|
45
|
+
raise_for_status(response)
|
|
46
|
+
return response.json()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
async def asyncio(
|
|
50
|
+
client: httpx.AsyncClient,
|
|
51
|
+
authorization: str | None = None,
|
|
52
|
+
x_api_key: str | None = None,
|
|
53
|
+
) -> Any:
|
|
54
|
+
"""Get Agent Artifacts"""
|
|
55
|
+
|
|
56
|
+
request_args = _build_request_args(
|
|
57
|
+
authorization=authorization,
|
|
58
|
+
x_api_key=x_api_key,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
response = await client.request(**request_args)
|
|
62
|
+
raise_for_status(response)
|
|
63
|
+
return response.json()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""API endpoints."""
|
|
2
|
+
|
|
3
|
+
from . import (
|
|
4
|
+
cleanup_stale_vms,
|
|
5
|
+
get_dispatchers,
|
|
6
|
+
get_nodes_status,
|
|
7
|
+
get_snapshot_lineage,
|
|
8
|
+
get_snapshots_status,
|
|
9
|
+
pause_resume_dispatchers,
|
|
10
|
+
prefetch_snapshot,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"prefetch_snapshot",
|
|
15
|
+
"pause_resume_dispatchers",
|
|
16
|
+
"get_snapshots_status",
|
|
17
|
+
"get_snapshot_lineage",
|
|
18
|
+
"get_nodes_status",
|
|
19
|
+
"get_dispatchers",
|
|
20
|
+
"cleanup_stale_vms",
|
|
21
|
+
]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Cleanup Stale Vms"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
from plato._generated.models import CleanupStaleVMsRequest, CleanupStaleVMsResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _build_request_args(
|
|
14
|
+
body: CleanupStaleVMsRequest,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
"""Build request arguments."""
|
|
17
|
+
url = "/api/v1/cluster/cleanup/stale-vms"
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
"method": "POST",
|
|
21
|
+
"url": url,
|
|
22
|
+
"json": body.model_dump(mode="json", exclude_none=True),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def sync(
|
|
27
|
+
client: httpx.Client,
|
|
28
|
+
body: CleanupStaleVMsRequest,
|
|
29
|
+
) -> CleanupStaleVMsResponse:
|
|
30
|
+
"""Clean up stale VMs that haven't sent heartbeats recently.
|
|
31
|
+
|
|
32
|
+
Requires internal service authentication.
|
|
33
|
+
|
|
34
|
+
A VM is considered stale if its last_server_heartbeat is older than
|
|
35
|
+
the specified threshold (default: 10 minutes).
|
|
36
|
+
|
|
37
|
+
This endpoint will:
|
|
38
|
+
1. Scan all VM records in Redis
|
|
39
|
+
2. Identify VMs with stale heartbeats
|
|
40
|
+
3. Send forced shutdown requests to each stale VM
|
|
41
|
+
4. Delete the VM records from Redis
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
cleanup_request: Cleanup parameters (threshold)
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
CleanupStaleVMsResponse with cleanup results"""
|
|
48
|
+
|
|
49
|
+
request_args = _build_request_args(
|
|
50
|
+
body=body,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
response = client.request(**request_args)
|
|
54
|
+
raise_for_status(response)
|
|
55
|
+
return CleanupStaleVMsResponse.model_validate(response.json())
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def asyncio(
|
|
59
|
+
client: httpx.AsyncClient,
|
|
60
|
+
body: CleanupStaleVMsRequest,
|
|
61
|
+
) -> CleanupStaleVMsResponse:
|
|
62
|
+
"""Clean up stale VMs that haven't sent heartbeats recently.
|
|
63
|
+
|
|
64
|
+
Requires internal service authentication.
|
|
65
|
+
|
|
66
|
+
A VM is considered stale if its last_server_heartbeat is older than
|
|
67
|
+
the specified threshold (default: 10 minutes).
|
|
68
|
+
|
|
69
|
+
This endpoint will:
|
|
70
|
+
1. Scan all VM records in Redis
|
|
71
|
+
2. Identify VMs with stale heartbeats
|
|
72
|
+
3. Send forced shutdown requests to each stale VM
|
|
73
|
+
4. Delete the VM records from Redis
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
cleanup_request: Cleanup parameters (threshold)
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
CleanupStaleVMsResponse with cleanup results"""
|
|
80
|
+
|
|
81
|
+
request_args = _build_request_args(
|
|
82
|
+
body=body,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
response = await client.request(**request_args)
|
|
86
|
+
raise_for_status(response)
|
|
87
|
+
return CleanupStaleVMsResponse.model_validate(response.json())
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Get Dispatchers"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
from plato._generated.models import DispatchersResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _build_request_args() -> dict[str, Any]:
|
|
14
|
+
"""Build request arguments."""
|
|
15
|
+
url = "/api/v1/cluster/dispatchers"
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
"method": "GET",
|
|
19
|
+
"url": url,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def sync(
|
|
24
|
+
client: httpx.Client,
|
|
25
|
+
) -> DispatchersResponse:
|
|
26
|
+
"""Get all Firecracker dispatchers with their status and VM counts.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
DispatchersResponse with all dispatcher information"""
|
|
30
|
+
|
|
31
|
+
request_args = _build_request_args()
|
|
32
|
+
|
|
33
|
+
response = client.request(**request_args)
|
|
34
|
+
raise_for_status(response)
|
|
35
|
+
return DispatchersResponse.model_validate(response.json())
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
async def asyncio(
|
|
39
|
+
client: httpx.AsyncClient,
|
|
40
|
+
) -> DispatchersResponse:
|
|
41
|
+
"""Get all Firecracker dispatchers with their status and VM counts.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
DispatchersResponse with all dispatcher information"""
|
|
45
|
+
|
|
46
|
+
request_args = _build_request_args()
|
|
47
|
+
|
|
48
|
+
response = await client.request(**request_args)
|
|
49
|
+
raise_for_status(response)
|
|
50
|
+
return DispatchersResponse.model_validate(response.json())
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Get Nodes Status"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
from plato._generated.models import NodeStatusResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _build_request_args() -> dict[str, Any]:
|
|
14
|
+
"""Build request arguments."""
|
|
15
|
+
url = "/api/v1/cluster/nodes/status"
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
"method": "GET",
|
|
19
|
+
"url": url,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def sync(
|
|
24
|
+
client: httpx.Client,
|
|
25
|
+
) -> NodeStatusResponse:
|
|
26
|
+
"""Get node/VM status across all Firecracker worker instances.
|
|
27
|
+
|
|
28
|
+
Returns detailed information about:
|
|
29
|
+
- Total instances with VMs
|
|
30
|
+
- Total active VMs across all instances
|
|
31
|
+
- Total capacity across all instances
|
|
32
|
+
- Per-instance VM counts by state
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
NodeStatusResponse with comprehensive node/VM status"""
|
|
36
|
+
|
|
37
|
+
request_args = _build_request_args()
|
|
38
|
+
|
|
39
|
+
response = client.request(**request_args)
|
|
40
|
+
raise_for_status(response)
|
|
41
|
+
return NodeStatusResponse.model_validate(response.json())
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
async def asyncio(
|
|
45
|
+
client: httpx.AsyncClient,
|
|
46
|
+
) -> NodeStatusResponse:
|
|
47
|
+
"""Get node/VM status across all Firecracker worker instances.
|
|
48
|
+
|
|
49
|
+
Returns detailed information about:
|
|
50
|
+
- Total instances with VMs
|
|
51
|
+
- Total active VMs across all instances
|
|
52
|
+
- Total capacity across all instances
|
|
53
|
+
- Per-instance VM counts by state
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
NodeStatusResponse with comprehensive node/VM status"""
|
|
57
|
+
|
|
58
|
+
request_args = _build_request_args()
|
|
59
|
+
|
|
60
|
+
response = await client.request(**request_args)
|
|
61
|
+
raise_for_status(response)
|
|
62
|
+
return NodeStatusResponse.model_validate(response.json())
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Get Snapshot Lineage"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from plato._generated.errors import raise_for_status
|
|
10
|
+
from plato._generated.models import ArtifactLineageResponse, SnapshotConfig
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _build_request_args(
|
|
14
|
+
artifact_id: str,
|
|
15
|
+
include_full_details: bool | None = None,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
"""Build request arguments."""
|
|
18
|
+
url = "/api/v1/cluster/snapshots/lineage"
|
|
19
|
+
|
|
20
|
+
params: dict[str, Any] = {}
|
|
21
|
+
if artifact_id is not None:
|
|
22
|
+
params["artifact_id"] = artifact_id
|
|
23
|
+
if include_full_details is not None:
|
|
24
|
+
params["include_full_details"] = include_full_details
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
"method": "GET",
|
|
28
|
+
"url": url,
|
|
29
|
+
"params": params,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def sync(
|
|
34
|
+
client: httpx.Client,
|
|
35
|
+
artifact_id: str,
|
|
36
|
+
include_full_details: bool | None = None,
|
|
37
|
+
) -> SnapshotConfig | ArtifactLineageResponse:
|
|
38
|
+
"""Build and return the full snapshot lineage for a given artifact ID.
|
|
39
|
+
|
|
40
|
+
This works for both regular snapshots and blockdiff checkpoints.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
artifact_id: The artifact ID to build lineage for
|
|
44
|
+
include_full_details: If True, returns full artifact details for migration purposes.
|
|
45
|
+
If False (default), returns minimal SnapshotConfig for VM operations."""
|
|
46
|
+
|
|
47
|
+
request_args = _build_request_args(
|
|
48
|
+
artifact_id=artifact_id,
|
|
49
|
+
include_full_details=include_full_details,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
response = client.request(**request_args)
|
|
53
|
+
raise_for_status(response)
|
|
54
|
+
return response.json()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
async def asyncio(
|
|
58
|
+
client: httpx.AsyncClient,
|
|
59
|
+
artifact_id: str,
|
|
60
|
+
include_full_details: bool | None = None,
|
|
61
|
+
) -> SnapshotConfig | ArtifactLineageResponse:
|
|
62
|
+
"""Build and return the full snapshot lineage for a given artifact ID.
|
|
63
|
+
|
|
64
|
+
This works for both regular snapshots and blockdiff checkpoints.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
artifact_id: The artifact ID to build lineage for
|
|
68
|
+
include_full_details: If True, returns full artifact details for migration purposes.
|
|
69
|
+
If False (default), returns minimal SnapshotConfig for VM operations."""
|
|
70
|
+
|
|
71
|
+
request_args = _build_request_args(
|
|
72
|
+
artifact_id=artifact_id,
|
|
73
|
+
include_full_details=include_full_details,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
response = await client.request(**request_args)
|
|
77
|
+
raise_for_status(response)
|
|
78
|
+
return response.json()
|