anyscale 0.24.86__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.
Files changed (1131) hide show
  1. anyscale/__init__.py +181 -0
  2. anyscale/_private/anyscale_client/README.md +16 -0
  3. anyscale/_private/anyscale_client/__init__.py +8 -0
  4. anyscale/_private/anyscale_client/anyscale_client.py +1847 -0
  5. anyscale/_private/anyscale_client/common.py +593 -0
  6. anyscale/_private/anyscale_client/fake_anyscale_client.py +1080 -0
  7. anyscale/_private/docgen/README.md +15 -0
  8. anyscale/_private/docgen/__main__.py +700 -0
  9. anyscale/_private/docgen/api.md +1106 -0
  10. anyscale/_private/docgen/generator.py +559 -0
  11. anyscale/_private/docgen/generator_legacy.py +104 -0
  12. anyscale/_private/docgen/models.md +2261 -0
  13. anyscale/_private/models/__init__.py +2 -0
  14. anyscale/_private/models/image_uri.py +116 -0
  15. anyscale/_private/models/model_base.py +251 -0
  16. anyscale/_private/sdk/__init__.py +102 -0
  17. anyscale/_private/sdk/base_sdk.py +35 -0
  18. anyscale/_private/sdk/timer.py +46 -0
  19. anyscale/_private/utils/__init__.py +0 -0
  20. anyscale/_private/utils/progress_util.py +85 -0
  21. anyscale/_private/workload/__init__.py +2 -0
  22. anyscale/_private/workload/workload_config.py +195 -0
  23. anyscale/_private/workload/workload_sdk.py +324 -0
  24. anyscale/aggregated_instance_usage/__init__.py +36 -0
  25. anyscale/aggregated_instance_usage/_private/aggregated_instance_usage_sdk.py +30 -0
  26. anyscale/aggregated_instance_usage/commands.py +42 -0
  27. anyscale/aggregated_instance_usage/models.py +85 -0
  28. anyscale/anyscale-cloud-setup-gcp-oa.yaml +88 -0
  29. anyscale/anyscale-cloud-setup-gcp.yaml +113 -0
  30. anyscale/anyscale-cloud-setup-oa.yaml +121 -0
  31. anyscale/anyscale-cloud-setup.yaml +327 -0
  32. anyscale/anyscale_pydantic/HISTORY.md +1254 -0
  33. anyscale/anyscale_pydantic/LICENSE +21 -0
  34. anyscale/anyscale_pydantic/PKG-INFO +1351 -0
  35. anyscale/anyscale_pydantic/README.md +7 -0
  36. anyscale/anyscale_pydantic/__init__.py +131 -0
  37. anyscale/anyscale_pydantic/_hypothesis_plugin.py +391 -0
  38. anyscale/anyscale_pydantic/annotated_types.py +72 -0
  39. anyscale/anyscale_pydantic/class_validators.py +361 -0
  40. anyscale/anyscale_pydantic/color.py +494 -0
  41. anyscale/anyscale_pydantic/config.py +191 -0
  42. anyscale/anyscale_pydantic/dataclasses.py +478 -0
  43. anyscale/anyscale_pydantic/datetime_parse.py +248 -0
  44. anyscale/anyscale_pydantic/decorator.py +264 -0
  45. anyscale/anyscale_pydantic/env_settings.py +350 -0
  46. anyscale/anyscale_pydantic/error_wrappers.py +162 -0
  47. anyscale/anyscale_pydantic/errors.py +646 -0
  48. anyscale/anyscale_pydantic/fields.py +1256 -0
  49. anyscale/anyscale_pydantic/generics.py +400 -0
  50. anyscale/anyscale_pydantic/json.py +112 -0
  51. anyscale/anyscale_pydantic/main.py +1109 -0
  52. anyscale/anyscale_pydantic/mypy.py +943 -0
  53. anyscale/anyscale_pydantic/networks.py +739 -0
  54. anyscale/anyscale_pydantic/parse.py +66 -0
  55. anyscale/anyscale_pydantic/py.typed +0 -0
  56. anyscale/anyscale_pydantic/schema.py +1164 -0
  57. anyscale/anyscale_pydantic/tools.py +92 -0
  58. anyscale/anyscale_pydantic/types.py +1206 -0
  59. anyscale/anyscale_pydantic/typing.py +603 -0
  60. anyscale/anyscale_pydantic/utils.py +803 -0
  61. anyscale/anyscale_pydantic/validators.py +765 -0
  62. anyscale/anyscale_pydantic/version.py +38 -0
  63. anyscale/anyscale_schema.json +9 -0
  64. anyscale/api.py +215 -0
  65. anyscale/api_utils/README.md +2 -0
  66. anyscale/api_utils/__init__.py +0 -0
  67. anyscale/api_utils/common_utils.py +81 -0
  68. anyscale/api_utils/exceptions/__init__.py +0 -0
  69. anyscale/api_utils/exceptions/job_errors.py +2 -0
  70. anyscale/api_utils/job_logs_util.py +116 -0
  71. anyscale/api_utils/job_util.py +22 -0
  72. anyscale/api_utils/logs_util.py +61 -0
  73. anyscale/authenticate.py +298 -0
  74. anyscale/aws_iam_policies.py +465 -0
  75. anyscale/background/__init__.py +0 -0
  76. anyscale/background/job_runner.py +64 -0
  77. anyscale/cli_logger.py +378 -0
  78. anyscale/client/.gitignore +66 -0
  79. anyscale/client/.openapi-generator/VERSION +1 -0
  80. anyscale/client/.openapi-generator-ignore +23 -0
  81. anyscale/client/README.md +1070 -0
  82. anyscale/client/git_push.sh +58 -0
  83. anyscale/client/openapi_client/__init__.py +667 -0
  84. anyscale/client/openapi_client/api/__init__.py +6 -0
  85. anyscale/client/openapi_client/api/default_api.py +40922 -0
  86. anyscale/client/openapi_client/api_client.py +647 -0
  87. anyscale/client/openapi_client/configuration.py +373 -0
  88. anyscale/client/openapi_client/exceptions.py +120 -0
  89. anyscale/client/openapi_client/models/__init__.py +652 -0
  90. anyscale/client/openapi_client/models/access_config.py +122 -0
  91. anyscale/client/openapi_client/models/aggregated_instance_usage_with_cost_model.py +733 -0
  92. anyscale/client/openapi_client/models/aggregatedinstanceusagewithcostmodel_list_response.py +147 -0
  93. anyscale/client/openapi_client/models/aica_endpoint.py +527 -0
  94. anyscale/client/openapi_client/models/aica_endpoint_event.py +433 -0
  95. anyscale/client/openapi_client/models/aica_endpoint_event_level.py +103 -0
  96. anyscale/client/openapi_client/models/aica_endpoint_event_type.py +120 -0
  97. anyscale/client/openapi_client/models/aica_endpoint_scope.py +102 -0
  98. anyscale/client/openapi_client/models/aica_model.py +398 -0
  99. anyscale/client/openapi_client/models/aica_model_accelerator_map.py +123 -0
  100. anyscale/client/openapi_client/models/aica_model_configuration.py +209 -0
  101. anyscale/client/openapi_client/models/aica_observability_urls.py +178 -0
  102. anyscale/client/openapi_client/models/aicaendpoint_list_response.py +147 -0
  103. anyscale/client/openapi_client/models/aicaendpoint_response.py +121 -0
  104. anyscale/client/openapi_client/models/aicaendpointevent_list_response.py +147 -0
  105. anyscale/client/openapi_client/models/aicamodel_list_response.py +147 -0
  106. anyscale/client/openapi_client/models/aicamodel_response.py +121 -0
  107. anyscale/client/openapi_client/models/aioa_cloud_waitlist_record.py +254 -0
  108. anyscale/client/openapi_client/models/aioacloudwaitlistrecord_response.py +121 -0
  109. anyscale/client/openapi_client/models/alert_type.py +103 -0
  110. anyscale/client/openapi_client/models/anyscale_aws_account.py +121 -0
  111. anyscale/client/openapi_client/models/anyscale_service_account.py +256 -0
  112. anyscale/client/openapi_client/models/anyscale_version_response.py +121 -0
  113. anyscale/client/openapi_client/models/anyscaleawsaccount_response.py +121 -0
  114. anyscale/client/openapi_client/models/anyscaled_credential_response.py +121 -0
  115. anyscale/client/openapi_client/models/anyscaledcredentialresponse_response.py +121 -0
  116. anyscale/client/openapi_client/models/anyscaleserviceaccount_response.py +121 -0
  117. anyscale/client/openapi_client/models/anyscaleversionresponse_response.py +121 -0
  118. anyscale/client/openapi_client/models/api_key_parameters.py +147 -0
  119. anyscale/client/openapi_client/models/app_config.py +436 -0
  120. anyscale/client/openapi_client/models/app_config_config_schema.py +235 -0
  121. anyscale/client/openapi_client/models/appconfig_list_response.py +147 -0
  122. anyscale/client/openapi_client/models/appconfig_response.py +121 -0
  123. anyscale/client/openapi_client/models/application_type.py +99 -0
  124. anyscale/client/openapi_client/models/applied_snapshot.py +175 -0
  125. anyscale/client/openapi_client/models/apply_production_service_v2_model.py +490 -0
  126. anyscale/client/openapi_client/models/archive_status.py +101 -0
  127. anyscale/client/openapi_client/models/archived_logs_info.py +164 -0
  128. anyscale/client/openapi_client/models/archivedlogsinfo_response.py +121 -0
  129. anyscale/client/openapi_client/models/attach_machine_pool_to_cloud_request.py +152 -0
  130. anyscale/client/openapi_client/models/attachmachinepooltocloudresponse_response.py +121 -0
  131. anyscale/client/openapi_client/models/aviary_model_config_v2.py +358 -0
  132. anyscale/client/openapi_client/models/aws_credentials.py +181 -0
  133. anyscale/client/openapi_client/models/aws_memory_db_cluster_config.py +148 -0
  134. anyscale/client/openapi_client/models/aws_region_and_zones.py +123 -0
  135. anyscale/client/openapi_client/models/aws_region_info.py +152 -0
  136. anyscale/client/openapi_client/models/awsregionandzones_response.py +121 -0
  137. anyscale/client/openapi_client/models/bank_account_information.py +239 -0
  138. anyscale/client/openapi_client/models/base_job_status.py +105 -0
  139. anyscale/client/openapi_client/models/baseimagesenum.py +2130 -0
  140. anyscale/client/openapi_client/models/batch_response_batched_result_organization_invitation_base.py +121 -0
  141. anyscale/client/openapi_client/models/batched_result_organization_invitation_base.py +173 -0
  142. anyscale/client/openapi_client/models/billing_information.py +181 -0
  143. anyscale/client/openapi_client/models/billing_version_code.py +100 -0
  144. anyscale/client/openapi_client/models/body_aws_marketplace_registration_api_v2_organization_billing_aws_marketplace_registration_post.py +121 -0
  145. anyscale/client/openapi_client/models/buffer_registration.py +285 -0
  146. anyscale/client/openapi_client/models/build.py +607 -0
  147. anyscale/client/openapi_client/models/build_log_response.py +123 -0
  148. anyscale/client/openapi_client/models/build_registration.py +285 -0
  149. anyscale/client/openapi_client/models/build_response.py +121 -0
  150. anyscale/client/openapi_client/models/build_status.py +104 -0
  151. anyscale/client/openapi_client/models/buildlogresponse_response.py +121 -0
  152. anyscale/client/openapi_client/models/card.py +181 -0
  153. anyscale/client/openapi_client/models/card_id.py +108 -0
  154. anyscale/client/openapi_client/models/card_list_response.py +147 -0
  155. anyscale/client/openapi_client/models/change_password_params.py +148 -0
  156. anyscale/client/openapi_client/models/cleanup_leaked_grafana_dashboard_response.py +208 -0
  157. anyscale/client/openapi_client/models/cleanupleakedgrafanadashboardresponse_response.py +121 -0
  158. anyscale/client/openapi_client/models/clone_experimental_workspace.py +151 -0
  159. anyscale/client/openapi_client/models/cloud.py +802 -0
  160. anyscale/client/openapi_client/models/cloud_analytics_event.py +351 -0
  161. anyscale/client/openapi_client/models/cloud_analytics_event_cloud_provider_error.py +152 -0
  162. anyscale/client/openapi_client/models/cloud_analytics_event_cloud_resource.py +117 -0
  163. anyscale/client/openapi_client/models/cloud_analytics_event_command_name.py +103 -0
  164. anyscale/client/openapi_client/models/cloud_analytics_event_error.py +150 -0
  165. anyscale/client/openapi_client/models/cloud_analytics_event_name.py +109 -0
  166. anyscale/client/openapi_client/models/cloud_collaborator.py +175 -0
  167. anyscale/client/openapi_client/models/cloud_collaborator_value.py +177 -0
  168. anyscale/client/openapi_client/models/cloud_collaborators_query.py +122 -0
  169. anyscale/client/openapi_client/models/cloud_config.py +206 -0
  170. anyscale/client/openapi_client/models/cloud_data_bucket_access_mode.py +100 -0
  171. anyscale/client/openapi_client/models/cloud_data_bucket_file_type.py +102 -0
  172. anyscale/client/openapi_client/models/cloud_data_bucket_presigned_upload_info.py +268 -0
  173. anyscale/client/openapi_client/models/cloud_data_bucket_presigned_upload_request.py +152 -0
  174. anyscale/client/openapi_client/models/cloud_data_bucket_presigned_upload_scheme.py +100 -0
  175. anyscale/client/openapi_client/models/cloud_data_bucket_presigned_url_request.py +209 -0
  176. anyscale/client/openapi_client/models/cloud_data_bucket_presigned_url_response.py +296 -0
  177. anyscale/client/openapi_client/models/cloud_data_bucket_presigned_url_scheme.py +100 -0
  178. anyscale/client/openapi_client/models/cloud_data_bucket_request_scope.py +100 -0
  179. anyscale/client/openapi_client/models/cloud_hosting_type.py +100 -0
  180. anyscale/client/openapi_client/models/cloud_list_response.py +147 -0
  181. anyscale/client/openapi_client/models/cloud_name_options.py +121 -0
  182. anyscale/client/openapi_client/models/cloud_overview_dashboard.py +175 -0
  183. anyscale/client/openapi_client/models/cloud_project_collaborator.py +175 -0
  184. anyscale/client/openapi_client/models/cloud_project_collaborator_value.py +121 -0
  185. anyscale/client/openapi_client/models/cloud_provider.py +102 -0
  186. anyscale/client/openapi_client/models/cloud_providers.py +103 -0
  187. anyscale/client/openapi_client/models/cloud_region_and_zones.py +123 -0
  188. anyscale/client/openapi_client/models/cloud_region_info.py +152 -0
  189. anyscale/client/openapi_client/models/cloud_resource.py +740 -0
  190. anyscale/client/openapi_client/models/cloud_resource_gcp.py +691 -0
  191. anyscale/client/openapi_client/models/cloud_response.py +121 -0
  192. anyscale/client/openapi_client/models/cloud_state.py +104 -0
  193. anyscale/client/openapi_client/models/cloud_status.py +100 -0
  194. anyscale/client/openapi_client/models/cloud_type.py +100 -0
  195. anyscale/client/openapi_client/models/cloud_types.py +100 -0
  196. anyscale/client/openapi_client/models/cloud_version.py +100 -0
  197. anyscale/client/openapi_client/models/cloud_waitlist_status.py +102 -0
  198. anyscale/client/openapi_client/models/cloud_with_cloud_resource.py +830 -0
  199. anyscale/client/openapi_client/models/cloud_with_cloud_resource_gcp.py +830 -0
  200. anyscale/client/openapi_client/models/cloudcollaborator_list_response.py +147 -0
  201. anyscale/client/openapi_client/models/clouddatabucketpresigneduploadinfo_response.py +121 -0
  202. anyscale/client/openapi_client/models/clouddatabucketpresignedurlresponse_response.py +121 -0
  203. anyscale/client/openapi_client/models/cloudoverviewdashboard_response.py +121 -0
  204. anyscale/client/openapi_client/models/cloudregionandzones_response.py +121 -0
  205. anyscale/client/openapi_client/models/cloudresource_response.py +121 -0
  206. anyscale/client/openapi_client/models/cloudresourcegcp_response.py +121 -0
  207. anyscale/client/openapi_client/models/cloudwithcloudresource_response.py +121 -0
  208. anyscale/client/openapi_client/models/cloudwithcloudresourcegcp_response.py +121 -0
  209. anyscale/client/openapi_client/models/cluster_auth_response.py +148 -0
  210. anyscale/client/openapi_client/models/cluster_config.py +178 -0
  211. anyscale/client/openapi_client/models/cluster_config_with_session_idle_timeout.py +204 -0
  212. anyscale/client/openapi_client/models/cluster_environments_query.py +290 -0
  213. anyscale/client/openapi_client/models/cluster_event.py +174 -0
  214. anyscale/client/openapi_client/models/cluster_events_output.py +175 -0
  215. anyscale/client/openapi_client/models/cluster_features.py +152 -0
  216. anyscale/client/openapi_client/models/cluster_management_stack_versions.py +100 -0
  217. anyscale/client/openapi_client/models/cluster_startup.py +208 -0
  218. anyscale/client/openapi_client/models/cluster_status.py +104 -0
  219. anyscale/client/openapi_client/models/cluster_status_details.py +100 -0
  220. anyscale/client/openapi_client/models/clusterauthresponse_response.py +121 -0
  221. anyscale/client/openapi_client/models/clusterconfig_response.py +121 -0
  222. anyscale/client/openapi_client/models/clusterconfigwithsessionidletimeout_response.py +121 -0
  223. anyscale/client/openapi_client/models/clustereventsoutput_response.py +121 -0
  224. anyscale/client/openapi_client/models/clusterfeatures_response.py +121 -0
  225. anyscale/client/openapi_client/models/company_size.py +103 -0
  226. anyscale/client/openapi_client/models/compute_node_type.py +292 -0
  227. anyscale/client/openapi_client/models/compute_stack.py +100 -0
  228. anyscale/client/openapi_client/models/compute_template.py +415 -0
  229. anyscale/client/openapi_client/models/compute_template_config.py +461 -0
  230. anyscale/client/openapi_client/models/compute_template_query.py +316 -0
  231. anyscale/client/openapi_client/models/computetemplate_response.py +121 -0
  232. anyscale/client/openapi_client/models/computetemplateconfig_response.py +121 -0
  233. anyscale/client/openapi_client/models/create_aica_endpoint.py +210 -0
  234. anyscale/client/openapi_client/models/create_aioa_cloud_waitlist.py +173 -0
  235. anyscale/client/openapi_client/models/create_analytics_event.py +122 -0
  236. anyscale/client/openapi_client/models/create_app_config.py +235 -0
  237. anyscale/client/openapi_client/models/create_app_config_configuration_schema.py +235 -0
  238. anyscale/client/openapi_client/models/create_billing_version.py +181 -0
  239. anyscale/client/openapi_client/models/create_bug_report_response.py +152 -0
  240. anyscale/client/openapi_client/models/create_build.py +263 -0
  241. anyscale/client/openapi_client/models/create_byod_app_config.py +180 -0
  242. anyscale/client/openapi_client/models/create_byod_app_config_configuration_schema.py +206 -0
  243. anyscale/client/openapi_client/models/create_byod_build.py +152 -0
  244. anyscale/client/openapi_client/models/create_cloud_collaborator.py +148 -0
  245. anyscale/client/openapi_client/models/create_cloud_resource.py +682 -0
  246. anyscale/client/openapi_client/models/create_cloud_resource_gcp.py +633 -0
  247. anyscale/client/openapi_client/models/create_cloud_with_cloud_resource.py +546 -0
  248. anyscale/client/openapi_client/models/create_cluster_compute_config.py +463 -0
  249. anyscale/client/openapi_client/models/create_compute_template.py +229 -0
  250. anyscale/client/openapi_client/models/create_compute_template_config.py +464 -0
  251. anyscale/client/openapi_client/models/create_dataset.py +200 -0
  252. anyscale/client/openapi_client/models/create_experimental_workspace.py +435 -0
  253. anyscale/client/openapi_client/models/create_experimental_workspace_from_job.py +123 -0
  254. anyscale/client/openapi_client/models/create_fine_tuning_hyperparameters.py +156 -0
  255. anyscale/client/openapi_client/models/create_fine_tuning_job_product_request.py +353 -0
  256. anyscale/client/openapi_client/models/create_instance_usage_budget.py +253 -0
  257. anyscale/client/openapi_client/models/create_internal_production_job.py +262 -0
  258. anyscale/client/openapi_client/models/create_job_queue_config.py +206 -0
  259. anyscale/client/openapi_client/models/create_job_queue_requests.py +323 -0
  260. anyscale/client/openapi_client/models/create_machine_pool_request.py +151 -0
  261. anyscale/client/openapi_client/models/create_machine_pool_response.py +123 -0
  262. anyscale/client/openapi_client/models/create_machine_request.py +151 -0
  263. anyscale/client/openapi_client/models/create_machine_response.py +123 -0
  264. anyscale/client/openapi_client/models/create_metronome_webhook_notification.py +175 -0
  265. anyscale/client/openapi_client/models/create_notification_channel_record.py +146 -0
  266. anyscale/client/openapi_client/models/create_organization_configuration.py +199 -0
  267. anyscale/client/openapi_client/models/create_organization_invitation.py +121 -0
  268. anyscale/client/openapi_client/models/create_otp_return_api_model.py +148 -0
  269. anyscale/client/openapi_client/models/create_production_job_config.py +347 -0
  270. anyscale/client/openapi_client/models/create_resource_quota.py +293 -0
  271. anyscale/client/openapi_client/models/create_schedule.py +263 -0
  272. anyscale/client/openapi_client/models/create_session_from_snapshot_options.py +565 -0
  273. anyscale/client/openapi_client/models/create_session_in_db.py +434 -0
  274. anyscale/client/openapi_client/models/create_session_response.py +174 -0
  275. anyscale/client/openapi_client/models/create_user.py +439 -0
  276. anyscale/client/openapi_client/models/create_user_project_collaborator.py +148 -0
  277. anyscale/client/openapi_client/models/create_user_project_collaborator_value.py +121 -0
  278. anyscale/client/openapi_client/models/create_workspace_from_template.py +263 -0
  279. anyscale/client/openapi_client/models/createbugreportresponse_response.py +121 -0
  280. anyscale/client/openapi_client/models/createcomputetemplateconfig_response.py +121 -0
  281. anyscale/client/openapi_client/models/createmachinepoolresponse_response.py +121 -0
  282. anyscale/client/openapi_client/models/createmachineresponse_response.py +121 -0
  283. anyscale/client/openapi_client/models/createotpreturnapimodel_response.py +121 -0
  284. anyscale/client/openapi_client/models/createsessionresponse_response.py +121 -0
  285. anyscale/client/openapi_client/models/credit_card_information.py +268 -0
  286. anyscale/client/openapi_client/models/customer_alert_status.py +101 -0
  287. anyscale/client/openapi_client/models/customer_billing_type.py +101 -0
  288. anyscale/client/openapi_client/models/dataplane_services.py +102 -0
  289. anyscale/client/openapi_client/models/dataset.py +416 -0
  290. anyscale/client/openapi_client/models/dataset_list_response.py +150 -0
  291. anyscale/client/openapi_client/models/dataset_response.py +121 -0
  292. anyscale/client/openapi_client/models/dataset_upload.py +148 -0
  293. anyscale/client/openapi_client/models/datasetupload_response.py +121 -0
  294. anyscale/client/openapi_client/models/decorated_application_template.py +493 -0
  295. anyscale/client/openapi_client/models/decorated_build.py +664 -0
  296. anyscale/client/openapi_client/models/decorated_compute_template.py +446 -0
  297. anyscale/client/openapi_client/models/decorated_compute_template_config.py +490 -0
  298. anyscale/client/openapi_client/models/decorated_interactive_session.py +793 -0
  299. anyscale/client/openapi_client/models/decorated_job.py +793 -0
  300. anyscale/client/openapi_client/models/decorated_job_queue.py +639 -0
  301. anyscale/client/openapi_client/models/decorated_job_submission.py +575 -0
  302. anyscale/client/openapi_client/models/decorated_list_service_api_model.py +670 -0
  303. anyscale/client/openapi_client/models/decorated_production_job.py +805 -0
  304. anyscale/client/openapi_client/models/decorated_production_job_state_transition.py +319 -0
  305. anyscale/client/openapi_client/models/decorated_production_service_v2_api_model.py +641 -0
  306. anyscale/client/openapi_client/models/decorated_production_service_v2_version_api_model.py +437 -0
  307. anyscale/client/openapi_client/models/decorated_runtime_env.py +488 -0
  308. anyscale/client/openapi_client/models/decorated_schedule.py +552 -0
  309. anyscale/client/openapi_client/models/decorated_serve_deployment.py +711 -0
  310. anyscale/client/openapi_client/models/decorated_service_event_api_model.py +513 -0
  311. anyscale/client/openapi_client/models/decorated_session.py +1789 -0
  312. anyscale/client/openapi_client/models/decorated_support_request.py +283 -0
  313. anyscale/client/openapi_client/models/decorated_unified_job.py +466 -0
  314. anyscale/client/openapi_client/models/decoratedapplicationtemplate_list_response.py +147 -0
  315. anyscale/client/openapi_client/models/decoratedapplicationtemplate_response.py +121 -0
  316. anyscale/client/openapi_client/models/decoratedbuild_list_response.py +147 -0
  317. anyscale/client/openapi_client/models/decoratedbuild_response.py +121 -0
  318. anyscale/client/openapi_client/models/decoratedcomputetemplate_list_response.py +147 -0
  319. anyscale/client/openapi_client/models/decoratedcomputetemplate_response.py +121 -0
  320. anyscale/client/openapi_client/models/decoratedinteractivesession_list_response.py +147 -0
  321. anyscale/client/openapi_client/models/decoratedinteractivesession_response.py +121 -0
  322. anyscale/client/openapi_client/models/decoratedjob_list_response.py +147 -0
  323. anyscale/client/openapi_client/models/decoratedjob_response.py +121 -0
  324. anyscale/client/openapi_client/models/decoratedjobqueue_list_response.py +147 -0
  325. anyscale/client/openapi_client/models/decoratedjobqueue_response.py +121 -0
  326. anyscale/client/openapi_client/models/decoratedjobsubmission_list_response.py +147 -0
  327. anyscale/client/openapi_client/models/decoratedjobsubmission_response.py +121 -0
  328. anyscale/client/openapi_client/models/decoratedlistserviceapimodel_list_response.py +147 -0
  329. anyscale/client/openapi_client/models/decoratedproductionjob_list_response.py +147 -0
  330. anyscale/client/openapi_client/models/decoratedproductionjob_response.py +121 -0
  331. anyscale/client/openapi_client/models/decoratedproductionjobstatetransition_list_response.py +147 -0
  332. anyscale/client/openapi_client/models/decoratedproductionservicev2_apimodel_response.py +121 -0
  333. anyscale/client/openapi_client/models/decoratedproductionservicev2_versionapimodel_list_response.py +147 -0
  334. anyscale/client/openapi_client/models/decoratedruntimeenv_list_response.py +147 -0
  335. anyscale/client/openapi_client/models/decoratedruntimeenv_response.py +121 -0
  336. anyscale/client/openapi_client/models/decoratedschedule_list_response.py +147 -0
  337. anyscale/client/openapi_client/models/decoratedschedule_response.py +121 -0
  338. anyscale/client/openapi_client/models/decoratedservedeployment_list_response.py +147 -0
  339. anyscale/client/openapi_client/models/decoratedservedeployment_response.py +121 -0
  340. anyscale/client/openapi_client/models/decoratedserviceeventapimodel_list_response.py +147 -0
  341. anyscale/client/openapi_client/models/decoratedsession_list_response.py +147 -0
  342. anyscale/client/openapi_client/models/decoratedsession_response.py +121 -0
  343. anyscale/client/openapi_client/models/decoratedsupportrequest_list_response.py +147 -0
  344. anyscale/client/openapi_client/models/decoratedsupportrequest_response.py +121 -0
  345. anyscale/client/openapi_client/models/decoratedunifiedjob_list_response.py +147 -0
  346. anyscale/client/openapi_client/models/decoratedunifiedjob_response.py +121 -0
  347. anyscale/client/openapi_client/models/delete_machine_pool_request.py +123 -0
  348. anyscale/client/openapi_client/models/delete_machine_request.py +206 -0
  349. anyscale/client/openapi_client/models/deleted_platform_fine_tuned_model.py +148 -0
  350. anyscale/client/openapi_client/models/deletedplatformfinetunedmodel_response.py +121 -0
  351. anyscale/client/openapi_client/models/deletemachinepoolresponse_response.py +121 -0
  352. anyscale/client/openapi_client/models/detach_machine_pool_from_cloud_request.py +152 -0
  353. anyscale/client/openapi_client/models/detachmachinepoolfromcloudresponse_response.py +121 -0
  354. anyscale/client/openapi_client/models/dismissal_type.py +100 -0
  355. anyscale/client/openapi_client/models/editable_cloud_resource.py +206 -0
  356. anyscale/client/openapi_client/models/editable_cloud_resource_gcp.py +178 -0
  357. anyscale/client/openapi_client/models/error.py +174 -0
  358. anyscale/client/openapi_client/models/event_level.py +104 -0
  359. anyscale/client/openapi_client/models/execute_command_response.py +175 -0
  360. anyscale/client/openapi_client/models/execute_interactive_command_options.py +147 -0
  361. anyscale/client/openapi_client/models/execute_shell_command_options.py +121 -0
  362. anyscale/client/openapi_client/models/executecommandresponse_response.py +121 -0
  363. anyscale/client/openapi_client/models/experimental_workspace.py +748 -0
  364. anyscale/client/openapi_client/models/experimental_workspaces_sort_field.py +100 -0
  365. anyscale/client/openapi_client/models/experimentalworkspace_list_response.py +147 -0
  366. anyscale/client/openapi_client/models/experimentalworkspace_response.py +121 -0
  367. anyscale/client/openapi_client/models/external_service_status.py +147 -0
  368. anyscale/client/openapi_client/models/external_service_status_response.py +250 -0
  369. anyscale/client/openapi_client/models/external_terminal_command.py +280 -0
  370. anyscale/client/openapi_client/models/externalservicestatusresponse_response.py +121 -0
  371. anyscale/client/openapi_client/models/feature_compatibility.py +152 -0
  372. anyscale/client/openapi_client/models/feature_flag_response.py +121 -0
  373. anyscale/client/openapi_client/models/featureflagresponse_response.py +121 -0
  374. anyscale/client/openapi_client/models/fine_tune_type.py +100 -0
  375. anyscale/client/openapi_client/models/fine_tuned_model.py +412 -0
  376. anyscale/client/openapi_client/models/fine_tuning_job_status.py +103 -0
  377. anyscale/client/openapi_client/models/finetunedmodel_list_response.py +147 -0
  378. anyscale/client/openapi_client/models/finetunedmodel_response.py +121 -0
  379. anyscale/client/openapi_client/models/finish_ft_job_request.py +204 -0
  380. anyscale/client/openapi_client/models/finish_ft_job_request_v2.py +183 -0
  381. anyscale/client/openapi_client/models/gcp_file_store_config.py +175 -0
  382. anyscale/client/openapi_client/models/gcp_memorystore_instance_config.py +148 -0
  383. anyscale/client/openapi_client/models/grafana_dashboard.py +201 -0
  384. anyscale/client/openapi_client/models/grpc_protocol_config.py +178 -0
  385. anyscale/client/openapi_client/models/ha_job_error_types.py +103 -0
  386. anyscale/client/openapi_client/models/ha_job_event_level.py +101 -0
  387. anyscale/client/openapi_client/models/ha_job_event_origin.py +100 -0
  388. anyscale/client/openapi_client/models/ha_job_goal_states.py +102 -0
  389. anyscale/client/openapi_client/models/ha_job_states.py +109 -0
  390. anyscale/client/openapi_client/models/ha_job_type.py +100 -0
  391. anyscale/client/openapi_client/models/ha_jobs_sort_field.py +105 -0
  392. anyscale/client/openapi_client/models/head_ip.py +121 -0
  393. anyscale/client/openapi_client/models/headip_response.py +121 -0
  394. anyscale/client/openapi_client/models/http_protocol_config.py +150 -0
  395. anyscale/client/openapi_client/models/http_validation_error.py +120 -0
  396. anyscale/client/openapi_client/models/idle_termination_status.py +104 -0
  397. anyscale/client/openapi_client/models/import_aica_model.py +241 -0
  398. anyscale/client/openapi_client/models/instance_usage_budget.py +572 -0
  399. anyscale/client/openapi_client/models/instance_usage_budget_evaluation_period.py +100 -0
  400. anyscale/client/openapi_client/models/instanceusagebudget_list_response.py +147 -0
  401. anyscale/client/openapi_client/models/instanceusagebudget_response.py +121 -0
  402. anyscale/client/openapi_client/models/integration_details.py +120 -0
  403. anyscale/client/openapi_client/models/interactive_session_logs.py +152 -0
  404. anyscale/client/openapi_client/models/interactivesessionlogs_response.py +121 -0
  405. anyscale/client/openapi_client/models/internal_production_job.py +663 -0
  406. anyscale/client/openapi_client/models/internalproductionjob_response.py +121 -0
  407. anyscale/client/openapi_client/models/invoice.py +413 -0
  408. anyscale/client/openapi_client/models/invoice_list_response.py +147 -0
  409. anyscale/client/openapi_client/models/invoice_status.py +102 -0
  410. anyscale/client/openapi_client/models/invoices_query.py +150 -0
  411. anyscale/client/openapi_client/models/job_access.py +102 -0
  412. anyscale/client/openapi_client/models/job_queue.py +467 -0
  413. anyscale/client/openapi_client/models/job_queue_config.py +122 -0
  414. anyscale/client/openapi_client/models/job_queue_execution_mode.py +101 -0
  415. anyscale/client/openapi_client/models/job_queue_spec.py +263 -0
  416. anyscale/client/openapi_client/models/job_queue_state.py +100 -0
  417. anyscale/client/openapi_client/models/job_queues_query.py +262 -0
  418. anyscale/client/openapi_client/models/job_run_type.py +101 -0
  419. anyscale/client/openapi_client/models/job_state_log_level_types.py +100 -0
  420. anyscale/client/openapi_client/models/job_status.py +105 -0
  421. anyscale/client/openapi_client/models/job_submissions_sort_field.py +101 -0
  422. anyscale/client/openapi_client/models/jobqueue_response.py +121 -0
  423. anyscale/client/openapi_client/models/jobs_logs.py +152 -0
  424. anyscale/client/openapi_client/models/jobs_logs_query_info.py +181 -0
  425. anyscale/client/openapi_client/models/jobs_sort_field.py +104 -0
  426. anyscale/client/openapi_client/models/jobslogs_response.py +121 -0
  427. anyscale/client/openapi_client/models/jobslogsqueryinfo_response.py +121 -0
  428. anyscale/client/openapi_client/models/json_patch_operation.py +200 -0
  429. anyscale/client/openapi_client/models/kubernetes_manager_registration_request.py +123 -0
  430. anyscale/client/openapi_client/models/kubernetes_manager_registration_response.py +123 -0
  431. anyscale/client/openapi_client/models/kubernetesmanagerregistrationresponse_response.py +121 -0
  432. anyscale/client/openapi_client/models/lb_resource.py +123 -0
  433. anyscale/client/openapi_client/models/lbresource_response.py +121 -0
  434. anyscale/client/openapi_client/models/list_machine_pools_response.py +123 -0
  435. anyscale/client/openapi_client/models/list_machines_response.py +121 -0
  436. anyscale/client/openapi_client/models/list_resource_quotas_query.py +234 -0
  437. anyscale/client/openapi_client/models/list_response_metadata.py +146 -0
  438. anyscale/client/openapi_client/models/listmachinepoolsresponse_response.py +121 -0
  439. anyscale/client/openapi_client/models/listmachinesresponse_response.py +121 -0
  440. anyscale/client/openapi_client/models/log_detail.py +187 -0
  441. anyscale/client/openapi_client/models/log_details.py +151 -0
  442. anyscale/client/openapi_client/models/log_download_config.py +206 -0
  443. anyscale/client/openapi_client/models/log_download_request.py +150 -0
  444. anyscale/client/openapi_client/models/log_download_result.py +207 -0
  445. anyscale/client/openapi_client/models/log_file_chunk.py +439 -0
  446. anyscale/client/openapi_client/models/log_filter.py +430 -0
  447. anyscale/client/openapi_client/models/log_item.py +181 -0
  448. anyscale/client/openapi_client/models/log_item_batch.py +151 -0
  449. anyscale/client/openapi_client/models/log_level_types.py +100 -0
  450. anyscale/client/openapi_client/models/log_stream.py +151 -0
  451. anyscale/client/openapi_client/models/logdetails_response.py +121 -0
  452. anyscale/client/openapi_client/models/logdownloadresult_response.py +121 -0
  453. anyscale/client/openapi_client/models/login_user_params.py +205 -0
  454. anyscale/client/openapi_client/models/logitembatch_response.py +121 -0
  455. anyscale/client/openapi_client/models/logs_output.py +202 -0
  456. anyscale/client/openapi_client/models/logsoutput_response.py +121 -0
  457. anyscale/client/openapi_client/models/logstream_response.py +121 -0
  458. anyscale/client/openapi_client/models/long_running_workload.py +256 -0
  459. anyscale/client/openapi_client/models/longrunningworkload_list_response.py +147 -0
  460. anyscale/client/openapi_client/models/machine_allocation_state.py +100 -0
  461. anyscale/client/openapi_client/models/machine_connection_state.py +100 -0
  462. anyscale/client/openapi_client/models/machine_info.py +466 -0
  463. anyscale/client/openapi_client/models/machine_pool.py +266 -0
  464. anyscale/client/openapi_client/models/metronome_customer_info_model.py +148 -0
  465. anyscale/client/openapi_client/models/metronome_dashboard_type.py +101 -0
  466. anyscale/client/openapi_client/models/metronomecustomerinfomodel_list_response.py +147 -0
  467. anyscale/client/openapi_client/models/metronomecustomerinfomodel_response.py +121 -0
  468. anyscale/client/openapi_client/models/mini_build.py +267 -0
  469. anyscale/client/openapi_client/models/mini_cloud.py +321 -0
  470. anyscale/client/openapi_client/models/mini_cluster.py +148 -0
  471. anyscale/client/openapi_client/models/mini_compute_template.py +228 -0
  472. anyscale/client/openapi_client/models/mini_compute_template_config.py +121 -0
  473. anyscale/client/openapi_client/models/mini_job_run.py +599 -0
  474. anyscale/client/openapi_client/models/mini_namespace.py +148 -0
  475. anyscale/client/openapi_client/models/mini_organization.py +148 -0
  476. anyscale/client/openapi_client/models/mini_production_job.py +202 -0
  477. anyscale/client/openapi_client/models/mini_project.py +205 -0
  478. anyscale/client/openapi_client/models/mini_runtime_environment.py +147 -0
  479. anyscale/client/openapi_client/models/mini_schedule.py +180 -0
  480. anyscale/client/openapi_client/models/mini_user.py +266 -0
  481. anyscale/client/openapi_client/models/minibuild_list_response.py +147 -0
  482. anyscale/client/openapi_client/models/minicomputetemplate_list_response.py +147 -0
  483. anyscale/client/openapi_client/models/miniproject_list_response.py +147 -0
  484. anyscale/client/openapi_client/models/monitor_logs_extension.py +100 -0
  485. anyscale/client/openapi_client/models/named_entity.py +148 -0
  486. anyscale/client/openapi_client/models/nfs_mount_target.py +151 -0
  487. anyscale/client/openapi_client/models/node_registration_aws.py +152 -0
  488. anyscale/client/openapi_client/models/node_registration_gcp.py +123 -0
  489. anyscale/client/openapi_client/models/node_registration_k8_s.py +178 -0
  490. anyscale/client/openapi_client/models/node_registration_provisioned.py +150 -0
  491. anyscale/client/openapi_client/models/node_registration_v2.py +279 -0
  492. anyscale/client/openapi_client/models/node_type.py +100 -0
  493. anyscale/client/openapi_client/models/notification_channel_email_config.py +121 -0
  494. anyscale/client/openapi_client/models/notification_channel_webhook_config.py +121 -0
  495. anyscale/client/openapi_client/models/onboarding_user_cards_query.py +122 -0
  496. anyscale/client/openapi_client/models/organization.py +490 -0
  497. anyscale/client/openapi_client/models/organization_availability.py +148 -0
  498. anyscale/client/openapi_client/models/organization_collaborator.py +259 -0
  499. anyscale/client/openapi_client/models/organization_configuration.py +280 -0
  500. anyscale/client/openapi_client/models/organization_configuration_response.py +227 -0
  501. anyscale/client/openapi_client/models/organization_invitation.py +255 -0
  502. anyscale/client/openapi_client/models/organization_invitation_base.py +121 -0
  503. anyscale/client/openapi_client/models/organization_marketing_questions.py +198 -0
  504. anyscale/client/openapi_client/models/organization_permission_level.py +100 -0
  505. anyscale/client/openapi_client/models/organization_project_collaborator.py +175 -0
  506. anyscale/client/openapi_client/models/organization_project_collaborator_value.py +148 -0
  507. anyscale/client/openapi_client/models/organization_public_identifier.py +121 -0
  508. anyscale/client/openapi_client/models/organization_response.py +121 -0
  509. anyscale/client/openapi_client/models/organization_summary.py +229 -0
  510. anyscale/client/openapi_client/models/organization_usage_alert.py +210 -0
  511. anyscale/client/openapi_client/models/organization_usage_alert_severity.py +100 -0
  512. anyscale/client/openapi_client/models/organizationavailability_response.py +121 -0
  513. anyscale/client/openapi_client/models/organizationcollaborator_list_response.py +147 -0
  514. anyscale/client/openapi_client/models/organizationconfiguration_list_response.py +147 -0
  515. anyscale/client/openapi_client/models/organizationconfigurationresponse_response.py +121 -0
  516. anyscale/client/openapi_client/models/organizationinvitation_list_response.py +147 -0
  517. anyscale/client/openapi_client/models/organizationinvitation_response.py +121 -0
  518. anyscale/client/openapi_client/models/organizationinvitationbase_response.py +121 -0
  519. anyscale/client/openapi_client/models/organizationprojectcollaborator_list_response.py +147 -0
  520. anyscale/client/openapi_client/models/organizationpublicidentifier_response.py +121 -0
  521. anyscale/client/openapi_client/models/organizationusagealert_list_response.py +147 -0
  522. anyscale/client/openapi_client/models/page_query.py +153 -0
  523. anyscale/client/openapi_client/models/pause_schedule.py +123 -0
  524. anyscale/client/openapi_client/models/permission_level.py +101 -0
  525. anyscale/client/openapi_client/models/platform_fine_tuning_job.py +577 -0
  526. anyscale/client/openapi_client/models/platformfinetuningjob_list_response.py +147 -0
  527. anyscale/client/openapi_client/models/platformfinetuningjob_response.py +121 -0
  528. anyscale/client/openapi_client/models/product_autoscaler_flag.py +122 -0
  529. anyscale/client/openapi_client/models/product_type.py +100 -0
  530. anyscale/client/openapi_client/models/productautoscalerflag_response.py +121 -0
  531. anyscale/client/openapi_client/models/production_job.py +437 -0
  532. anyscale/client/openapi_client/models/production_job_config.py +348 -0
  533. anyscale/client/openapi_client/models/production_job_event.py +378 -0
  534. anyscale/client/openapi_client/models/production_job_event_scope_filter.py +101 -0
  535. anyscale/client/openapi_client/models/production_job_state_transition.py +293 -0
  536. anyscale/client/openapi_client/models/productionjob_response.py +121 -0
  537. anyscale/client/openapi_client/models/productionjobevent_list_response.py +147 -0
  538. anyscale/client/openapi_client/models/project.py +554 -0
  539. anyscale/client/openapi_client/models/project_base.py +121 -0
  540. anyscale/client/openapi_client/models/project_collaborator.py +175 -0
  541. anyscale/client/openapi_client/models/project_collaborator_value.py +175 -0
  542. anyscale/client/openapi_client/models/project_collaborators_put_message.py +121 -0
  543. anyscale/client/openapi_client/models/project_create_message.py +148 -0
  544. anyscale/client/openapi_client/models/project_default_session_name.py +121 -0
  545. anyscale/client/openapi_client/models/project_delete_message.py +121 -0
  546. anyscale/client/openapi_client/models/project_list_response.py +147 -0
  547. anyscale/client/openapi_client/models/project_patch_message.py +121 -0
  548. anyscale/client/openapi_client/models/project_response.py +121 -0
  549. anyscale/client/openapi_client/models/projectbase_response.py +121 -0
  550. anyscale/client/openapi_client/models/projectcollaborator_list_response.py +147 -0
  551. anyscale/client/openapi_client/models/projectdefaultsessionname_response.py +121 -0
  552. anyscale/client/openapi_client/models/projects_sort_field.py +101 -0
  553. anyscale/client/openapi_client/models/projects_violating_tree_hierarchy_response.py +121 -0
  554. anyscale/client/openapi_client/models/projectsviolatingtreehierarchyresponse_response.py +121 -0
  555. anyscale/client/openapi_client/models/protocols.py +150 -0
  556. anyscale/client/openapi_client/models/provider_metadata.py +205 -0
  557. anyscale/client/openapi_client/models/providermetadata_response.py +121 -0
  558. anyscale/client/openapi_client/models/python_modules.py +150 -0
  559. anyscale/client/openapi_client/models/quota.py +198 -0
  560. anyscale/client/openapi_client/models/ray_gcs_external_storage_config.py +178 -0
  561. anyscale/client/openapi_client/models/ray_runtime_env_config.py +262 -0
  562. anyscale/client/openapi_client/models/read_billing_version.py +210 -0
  563. anyscale/client/openapi_client/models/readbillingversion_list_response.py +147 -0
  564. anyscale/client/openapi_client/models/replica_details.py +152 -0
  565. anyscale/client/openapi_client/models/replica_state.py +104 -0
  566. anyscale/client/openapi_client/models/request_email_magic_link_response.py +147 -0
  567. anyscale/client/openapi_client/models/request_otp_return_api_model.py +148 -0
  568. anyscale/client/openapi_client/models/request_password_reset_params.py +147 -0
  569. anyscale/client/openapi_client/models/requestemailmagiclinkresponse_response.py +121 -0
  570. anyscale/client/openapi_client/models/requestotpreturnapimodel_response.py +121 -0
  571. anyscale/client/openapi_client/models/reset_password_params.py +148 -0
  572. anyscale/client/openapi_client/models/resource_quota.py +465 -0
  573. anyscale/client/openapi_client/models/resource_quota_status.py +123 -0
  574. anyscale/client/openapi_client/models/resourcequota_list_response.py +147 -0
  575. anyscale/client/openapi_client/models/resourcequota_response.py +121 -0
  576. anyscale/client/openapi_client/models/resources.py +234 -0
  577. anyscale/client/openapi_client/models/resubmit_ft_job_request.py +121 -0
  578. anyscale/client/openapi_client/models/rollback_service_model.py +122 -0
  579. anyscale/client/openapi_client/models/rollout_strategy.py +100 -0
  580. anyscale/client/openapi_client/models/s3_download_location.py +148 -0
  581. anyscale/client/openapi_client/models/schedule_config.py +151 -0
  582. anyscale/client/openapi_client/models/serve_deployment_grafana_dashboard_status.py +101 -0
  583. anyscale/client/openapi_client/models/serve_deployment_logs.py +152 -0
  584. anyscale/client/openapi_client/models/serve_deployment_state.py +104 -0
  585. anyscale/client/openapi_client/models/servedeploymentlogs_response.py +121 -0
  586. anyscale/client/openapi_client/models/server_session_token.py +121 -0
  587. anyscale/client/openapi_client/models/serversessiontoken_response.py +121 -0
  588. anyscale/client/openapi_client/models/service_config.py +178 -0
  589. anyscale/client/openapi_client/models/service_event_current_state.py +108 -0
  590. anyscale/client/openapi_client/models/service_event_level.py +102 -0
  591. anyscale/client/openapi_client/models/service_event_origin.py +103 -0
  592. anyscale/client/openapi_client/models/service_event_scope.py +103 -0
  593. anyscale/client/openapi_client/models/service_event_scope_filter.py +104 -0
  594. anyscale/client/openapi_client/models/service_event_type.py +125 -0
  595. anyscale/client/openapi_client/models/service_event_verbose_message_model.py +180 -0
  596. anyscale/client/openapi_client/models/service_goal_states.py +100 -0
  597. anyscale/client/openapi_client/models/service_observability_urls.py +206 -0
  598. anyscale/client/openapi_client/models/service_sort_field.py +101 -0
  599. anyscale/client/openapi_client/models/service_type.py +100 -0
  600. anyscale/client/openapi_client/models/service_usage.py +353 -0
  601. anyscale/client/openapi_client/models/service_version_state.py +106 -0
  602. anyscale/client/openapi_client/models/serviceeventverbosemessagemodel_list_response.py +147 -0
  603. anyscale/client/openapi_client/models/session.py +834 -0
  604. anyscale/client/openapi_client/models/session_access.py +102 -0
  605. anyscale/client/openapi_client/models/session_autosync_sessions_update_message.py +121 -0
  606. anyscale/client/openapi_client/models/session_command.py +413 -0
  607. anyscale/client/openapi_client/models/session_command_finish_options.py +226 -0
  608. anyscale/client/openapi_client/models/session_command_id.py +121 -0
  609. anyscale/client/openapi_client/models/session_command_types.py +100 -0
  610. anyscale/client/openapi_client/models/session_create_message.py +148 -0
  611. anyscale/client/openapi_client/models/session_delete_message.py +121 -0
  612. anyscale/client/openapi_client/models/session_describe.py +175 -0
  613. anyscale/client/openapi_client/models/session_details.py +148 -0
  614. anyscale/client/openapi_client/models/session_event.py +267 -0
  615. anyscale/client/openapi_client/models/session_event_cause.py +150 -0
  616. anyscale/client/openapi_client/models/session_event_types.py +111 -0
  617. anyscale/client/openapi_client/models/session_execute_message.py +121 -0
  618. anyscale/client/openapi_client/models/session_finish_command_message.py +175 -0
  619. anyscale/client/openapi_client/models/session_history_item.py +146 -0
  620. anyscale/client/openapi_client/models/session_kill_command_message.py +121 -0
  621. anyscale/client/openapi_client/models/session_list_response.py +147 -0
  622. anyscale/client/openapi_client/models/session_patch_message.py +121 -0
  623. anyscale/client/openapi_client/models/session_response.py +121 -0
  624. anyscale/client/openapi_client/models/session_ssh_key.py +148 -0
  625. anyscale/client/openapi_client/models/session_starting_up_data.py +146 -0
  626. anyscale/client/openapi_client/models/session_state.py +111 -0
  627. anyscale/client/openapi_client/models/session_state_change_message.py +121 -0
  628. anyscale/client/openapi_client/models/session_state_data.py +146 -0
  629. anyscale/client/openapi_client/models/session_stopping_data.py +146 -0
  630. anyscale/client/openapi_client/models/sessioncommand_list_response.py +147 -0
  631. anyscale/client/openapi_client/models/sessioncommandid_response.py +121 -0
  632. anyscale/client/openapi_client/models/sessiondescribe_response.py +121 -0
  633. anyscale/client/openapi_client/models/sessiondetails_response.py +121 -0
  634. anyscale/client/openapi_client/models/sessionevent_list_response.py +147 -0
  635. anyscale/client/openapi_client/models/sessionhistoryitem_list_response.py +147 -0
  636. anyscale/client/openapi_client/models/sessions_sort_field.py +104 -0
  637. anyscale/client/openapi_client/models/sessionsshkey_response.py +121 -0
  638. anyscale/client/openapi_client/models/setup_initialize_session_options.py +225 -0
  639. anyscale/client/openapi_client/models/show_otp_source_return_api_model.py +121 -0
  640. anyscale/client/openapi_client/models/showotpsourcereturnapimodel_response.py +121 -0
  641. anyscale/client/openapi_client/models/snapshot_create_message.py +148 -0
  642. anyscale/client/openapi_client/models/snapshot_delete_message.py +148 -0
  643. anyscale/client/openapi_client/models/snapshot_patch_message.py +148 -0
  644. anyscale/client/openapi_client/models/socket_message_schemas.py +499 -0
  645. anyscale/client/openapi_client/models/socket_message_types.py +113 -0
  646. anyscale/client/openapi_client/models/socketmessageschemas_response.py +121 -0
  647. anyscale/client/openapi_client/models/socketmessagetypes_response.py +121 -0
  648. anyscale/client/openapi_client/models/sort_order.py +100 -0
  649. anyscale/client/openapi_client/models/sso_login_info.py +151 -0
  650. anyscale/client/openapi_client/models/ssologininfo_response.py +121 -0
  651. anyscale/client/openapi_client/models/start_session_options.py +146 -0
  652. anyscale/client/openapi_client/models/stop_session_options.py +227 -0
  653. anyscale/client/openapi_client/models/stream_publish_request.py +239 -0
  654. anyscale/client/openapi_client/models/subnet_id_with_availability_zone_aws.py +148 -0
  655. anyscale/client/openapi_client/models/support_requests_query.py +178 -0
  656. anyscale/client/openapi_client/models/supportedbaseimagesenum.py +1570 -0
  657. anyscale/client/openapi_client/models/templatized_compute_configs.py +202 -0
  658. anyscale/client/openapi_client/models/templatized_decorated_application_templates.py +202 -0
  659. anyscale/client/openapi_client/models/templatizedcomputeconfigs_response.py +121 -0
  660. anyscale/client/openapi_client/models/templatizeddecoratedapplicationtemplates_response.py +121 -0
  661. anyscale/client/openapi_client/models/text_query.py +178 -0
  662. anyscale/client/openapi_client/models/timestamped_logs_output.py +148 -0
  663. anyscale/client/openapi_client/models/timestampedlogsoutput_response.py +121 -0
  664. anyscale/client/openapi_client/models/tool.py +100 -0
  665. anyscale/client/openapi_client/models/tracing_config.py +178 -0
  666. anyscale/client/openapi_client/models/try_login_email_response.py +208 -0
  667. anyscale/client/openapi_client/models/tryloginemailresponse_response.py +121 -0
  668. anyscale/client/openapi_client/models/unified_job_sort_field.py +103 -0
  669. anyscale/client/openapi_client/models/unified_job_status.py +114 -0
  670. anyscale/client/openapi_client/models/unified_job_type.py +100 -0
  671. anyscale/client/openapi_client/models/update_cloud_with_cloud_resource.py +178 -0
  672. anyscale/client/openapi_client/models/update_cloud_with_cloud_resource_gcp.py +178 -0
  673. anyscale/client/openapi_client/models/update_cluster_dns.py +152 -0
  674. anyscale/client/openapi_client/models/update_compute_template.py +146 -0
  675. anyscale/client/openapi_client/models/update_compute_template_config.py +464 -0
  676. anyscale/client/openapi_client/models/update_endpoint.py +152 -0
  677. anyscale/client/openapi_client/models/update_machine_pool_request.py +151 -0
  678. anyscale/client/openapi_client/models/update_model_deployment.py +152 -0
  679. anyscale/client/openapi_client/models/update_organization_collaborator.py +121 -0
  680. anyscale/client/openapi_client/models/update_project_collaborator.py +121 -0
  681. anyscale/client/openapi_client/models/update_resource_quota.py +122 -0
  682. anyscale/client/openapi_client/models/updatemachinepoolresponse_response.py +121 -0
  683. anyscale/client/openapi_client/models/upload_session_command_logs_locations.py +148 -0
  684. anyscale/client/openapi_client/models/uploadsessioncommandlogslocations_response.py +121 -0
  685. anyscale/client/openapi_client/models/user_info.py +569 -0
  686. anyscale/client/openapi_client/models/user_resend_email_options.py +147 -0
  687. anyscale/client/openapi_client/models/user_service_access_types.py +100 -0
  688. anyscale/client/openapi_client/models/userinfo_response.py +121 -0
  689. anyscale/client/openapi_client/models/utm_fields.py +224 -0
  690. anyscale/client/openapi_client/models/ux_instance.py +468 -0
  691. anyscale/client/openapi_client/models/validate_otp_params_api_model.py +121 -0
  692. anyscale/client/openapi_client/models/validation_error.py +175 -0
  693. anyscale/client/openapi_client/models/verify_response.py +147 -0
  694. anyscale/client/openapi_client/models/verifyresponse_response.py +121 -0
  695. anyscale/client/openapi_client/models/visibility.py +100 -0
  696. anyscale/client/openapi_client/models/waitlist_status_response.py +121 -0
  697. anyscale/client/openapi_client/models/waitlist_status_type.py +100 -0
  698. anyscale/client/openapi_client/models/waitliststatusresponse_response.py +121 -0
  699. anyscale/client/openapi_client/models/wand_b_run_details.py +147 -0
  700. anyscale/client/openapi_client/models/web_terminal.py +121 -0
  701. anyscale/client/openapi_client/models/webterminal_list_response.py +147 -0
  702. anyscale/client/openapi_client/models/webterminal_response.py +121 -0
  703. anyscale/client/openapi_client/models/worker_node_type.py +404 -0
  704. anyscale/client/openapi_client/models/workload_type.py +102 -0
  705. anyscale/client/openapi_client/models/workspace_dataplane_artifact.py +181 -0
  706. anyscale/client/openapi_client/models/workspace_dataplane_artifacts.py +123 -0
  707. anyscale/client/openapi_client/models/workspace_dataplane_proxied_artifacts.py +178 -0
  708. anyscale/client/openapi_client/models/workspace_event.py +325 -0
  709. anyscale/client/openapi_client/models/workspace_event_source.py +100 -0
  710. anyscale/client/openapi_client/models/workspace_event_source_filter.py +101 -0
  711. anyscale/client/openapi_client/models/workspace_readme.py +123 -0
  712. anyscale/client/openapi_client/models/workspace_snapshot_states.py +108 -0
  713. anyscale/client/openapi_client/models/workspace_template.py +353 -0
  714. anyscale/client/openapi_client/models/workspace_template_cluster_environment_metadata.py +178 -0
  715. anyscale/client/openapi_client/models/workspacedataplaneartifacts_response.py +121 -0
  716. anyscale/client/openapi_client/models/workspacedataplaneproxiedartifacts_response.py +121 -0
  717. anyscale/client/openapi_client/models/workspaceevent_list_response.py +147 -0
  718. anyscale/client/openapi_client/models/workspacereadme_response.py +121 -0
  719. anyscale/client/openapi_client/models/workspacetemplate_list_response.py +147 -0
  720. anyscale/client/openapi_client/models/workspacetemplateclusterenvironmentmetadata_response.py +121 -0
  721. anyscale/client/openapi_client/models/write_cloud.py +546 -0
  722. anyscale/client/openapi_client/models/write_cluster_config.py +123 -0
  723. anyscale/client/openapi_client/models/write_project.py +226 -0
  724. anyscale/client/openapi_client/models/write_session.py +147 -0
  725. anyscale/client/openapi_client/models/write_support_request.py +121 -0
  726. anyscale/client/openapi_client/rest.py +296 -0
  727. anyscale/client/requirements.txt +6 -0
  728. anyscale/client/setup.cfg +2 -0
  729. anyscale/client/setup.py +40 -0
  730. anyscale/client/test-requirements.txt +3 -0
  731. anyscale/client/tox.ini +9 -0
  732. anyscale/cloud.py +216 -0
  733. anyscale/cloud_resource.py +1032 -0
  734. anyscale/cluster.py +138 -0
  735. anyscale/cluster_compute.py +167 -0
  736. anyscale/cluster_env.py +173 -0
  737. anyscale/commands/__init__.py +0 -0
  738. anyscale/commands/aggregated_instance_usage_commands.py +86 -0
  739. anyscale/commands/anyscale_api/__init__.py +0 -0
  740. anyscale/commands/anyscale_api/api_commands.py +23 -0
  741. anyscale/commands/anyscale_api/session_commands_commands.py +80 -0
  742. anyscale/commands/anyscale_api/session_operations_commands.py +28 -0
  743. anyscale/commands/anyscale_api/sessions_commands.py +152 -0
  744. anyscale/commands/auth_commands.py +41 -0
  745. anyscale/commands/cloud_commands.py +1011 -0
  746. anyscale/commands/cloud_commands_util.py +10 -0
  747. anyscale/commands/cluster_commands.py +476 -0
  748. anyscale/commands/cluster_env_commands.py +139 -0
  749. anyscale/commands/command_examples.py +495 -0
  750. anyscale/commands/compute_config_commands.py +252 -0
  751. anyscale/commands/config_commands.py +213 -0
  752. anyscale/commands/exec_commands.py +14 -0
  753. anyscale/commands/experimental_integrations_commands.py +70 -0
  754. anyscale/commands/image_commands.py +125 -0
  755. anyscale/commands/job_commands.py +745 -0
  756. anyscale/commands/list_commands.py +85 -0
  757. anyscale/commands/llm/dataset_commands.py +269 -0
  758. anyscale/commands/llm/group.py +15 -0
  759. anyscale/commands/llm/models_commands.py +123 -0
  760. anyscale/commands/login_commands.py +79 -0
  761. anyscale/commands/logs_commands.py +312 -0
  762. anyscale/commands/machine_commands.py +116 -0
  763. anyscale/commands/machine_pool_commands.py +163 -0
  764. anyscale/commands/migrate_commands.py +84 -0
  765. anyscale/commands/project_commands.py +203 -0
  766. anyscale/commands/resource_quota_commands.py +214 -0
  767. anyscale/commands/schedule_commands.py +436 -0
  768. anyscale/commands/service_account_commands.py +72 -0
  769. anyscale/commands/service_commands.py +738 -0
  770. anyscale/commands/session_commands_hidden.py +179 -0
  771. anyscale/commands/util.py +152 -0
  772. anyscale/commands/workspace_commands.py +511 -0
  773. anyscale/commands/workspace_commands_v2.py +874 -0
  774. anyscale/component_activity_util.py +83 -0
  775. anyscale/compute_config/__init__.py +84 -0
  776. anyscale/compute_config/_private/compute_config_sdk.py +433 -0
  777. anyscale/compute_config/commands.py +122 -0
  778. anyscale/compute_config/models.py +630 -0
  779. anyscale/conf.py +23 -0
  780. anyscale/connect.py +1323 -0
  781. anyscale/connect_utils/__init__.py +0 -0
  782. anyscale/connect_utils/prepare_cluster.py +962 -0
  783. anyscale/connect_utils/project.py +298 -0
  784. anyscale/connect_utils/start_interactive_session.py +437 -0
  785. anyscale/controllers/__init__.py +0 -0
  786. anyscale/controllers/auth_controller.py +134 -0
  787. anyscale/controllers/base_controller.py +52 -0
  788. anyscale/controllers/cloud_controller.py +3609 -0
  789. anyscale/controllers/cloud_functional_verification_controller.py +858 -0
  790. anyscale/controllers/cluster_controller.py +720 -0
  791. anyscale/controllers/cluster_env_controller.py +219 -0
  792. anyscale/controllers/compute_config_controller.py +351 -0
  793. anyscale/controllers/config_controller.py +422 -0
  794. anyscale/controllers/experimental_integrations_controller.py +80 -0
  795. anyscale/controllers/job_controller.py +647 -0
  796. anyscale/controllers/jobs_bg_controller.py +0 -0
  797. anyscale/controllers/list_controller.py +290 -0
  798. anyscale/controllers/llm/__init__.py +0 -0
  799. anyscale/controllers/llm/models_controller.py +144 -0
  800. anyscale/controllers/logs_controller.py +449 -0
  801. anyscale/controllers/machine_controller.py +37 -0
  802. anyscale/controllers/machine_pool_controller.py +86 -0
  803. anyscale/controllers/project_controller.py +281 -0
  804. anyscale/controllers/resource_quota_controller.py +183 -0
  805. anyscale/controllers/schedule_controller.py +333 -0
  806. anyscale/controllers/service_account_controller.py +168 -0
  807. anyscale/controllers/service_controller.py +453 -0
  808. anyscale/controllers/workspace_controller.py +253 -0
  809. anyscale/feature_flags.py +4 -0
  810. anyscale/fingerprint.py +62 -0
  811. anyscale/formatters/__init__.py +0 -0
  812. anyscale/formatters/clouds_formatter.py +65 -0
  813. anyscale/formatters/common_formatter.py +22 -0
  814. anyscale/gcp_verification.py +792 -0
  815. anyscale/image/__init__.py +73 -0
  816. anyscale/image/_private/image_sdk.py +202 -0
  817. anyscale/image/commands.py +117 -0
  818. anyscale/image/models.py +57 -0
  819. anyscale/integrations.py +329 -0
  820. anyscale/job/__init__.py +166 -0
  821. anyscale/job/_private/job_sdk.py +497 -0
  822. anyscale/job/commands.py +267 -0
  823. anyscale/job/models.py +500 -0
  824. anyscale/links.py +4 -0
  825. anyscale/llm/__init__.py +2 -0
  826. anyscale/llm/dataset/__init__.py +2 -0
  827. anyscale/llm/dataset/_private/__init__.py +0 -0
  828. anyscale/llm/dataset/_private/docs.py +63 -0
  829. anyscale/llm/dataset/_private/models.py +71 -0
  830. anyscale/llm/dataset/_private/sdk.py +147 -0
  831. anyscale/llm/model/__init__.py +2 -0
  832. anyscale/llm/model/_private/models_sdk.py +62 -0
  833. anyscale/llm/model/commands.py +93 -0
  834. anyscale/llm/model/models.py +171 -0
  835. anyscale/llm/model/sdk.py +62 -0
  836. anyscale/llm/sdk.py +27 -0
  837. anyscale/memorydb_supported_zones.json +22 -0
  838. anyscale/models/job_model.py +457 -0
  839. anyscale/models/service_model.py +125 -0
  840. anyscale/project.py +501 -0
  841. anyscale/schedule/__init__.py +91 -0
  842. anyscale/schedule/_private/schedule_sdk.py +165 -0
  843. anyscale/schedule/commands.py +149 -0
  844. anyscale/schedule/models.py +145 -0
  845. anyscale/scripts.py +164 -0
  846. anyscale/sdk/anyscale_client/__init__.py +235 -0
  847. anyscale/sdk/anyscale_client/api/__init__.py +6 -0
  848. anyscale/sdk/anyscale_client/api/default_api.py +11625 -0
  849. anyscale/sdk/anyscale_client/api_client.py +647 -0
  850. anyscale/sdk/anyscale_client/configuration.py +373 -0
  851. anyscale/sdk/anyscale_client/exceptions.py +120 -0
  852. anyscale/sdk/anyscale_client/models/__init__.py +220 -0
  853. anyscale/sdk/anyscale_client/models/access_config.py +122 -0
  854. anyscale/sdk/anyscale_client/models/app_config.py +436 -0
  855. anyscale/sdk/anyscale_client/models/app_config_config_schema.py +235 -0
  856. anyscale/sdk/anyscale_client/models/appconfig_list_response.py +147 -0
  857. anyscale/sdk/anyscale_client/models/appconfig_response.py +121 -0
  858. anyscale/sdk/anyscale_client/models/apply_production_service_v2_model.py +490 -0
  859. anyscale/sdk/anyscale_client/models/apply_service_model.py +490 -0
  860. anyscale/sdk/anyscale_client/models/archive_status.py +101 -0
  861. anyscale/sdk/anyscale_client/models/base_job_status.py +105 -0
  862. anyscale/sdk/anyscale_client/models/baseimagesenum.py +2130 -0
  863. anyscale/sdk/anyscale_client/models/build.py +607 -0
  864. anyscale/sdk/anyscale_client/models/build_list_response.py +147 -0
  865. anyscale/sdk/anyscale_client/models/build_log_response.py +123 -0
  866. anyscale/sdk/anyscale_client/models/build_response.py +121 -0
  867. anyscale/sdk/anyscale_client/models/build_status.py +104 -0
  868. anyscale/sdk/anyscale_client/models/buildlogresponse_response.py +121 -0
  869. anyscale/sdk/anyscale_client/models/cloud.py +802 -0
  870. anyscale/sdk/anyscale_client/models/cloud_config.py +206 -0
  871. anyscale/sdk/anyscale_client/models/cloud_list_response.py +147 -0
  872. anyscale/sdk/anyscale_client/models/cloud_providers.py +103 -0
  873. anyscale/sdk/anyscale_client/models/cloud_response.py +121 -0
  874. anyscale/sdk/anyscale_client/models/cloud_state.py +104 -0
  875. anyscale/sdk/anyscale_client/models/cloud_status.py +100 -0
  876. anyscale/sdk/anyscale_client/models/cloud_type.py +100 -0
  877. anyscale/sdk/anyscale_client/models/cloud_types.py +100 -0
  878. anyscale/sdk/anyscale_client/models/cloud_version.py +100 -0
  879. anyscale/sdk/anyscale_client/models/clouds_query.py +150 -0
  880. anyscale/sdk/anyscale_client/models/cluster.py +721 -0
  881. anyscale/sdk/anyscale_client/models/cluster_compute.py +415 -0
  882. anyscale/sdk/anyscale_client/models/cluster_compute_config.py +461 -0
  883. anyscale/sdk/anyscale_client/models/cluster_computes_query.py +293 -0
  884. anyscale/sdk/anyscale_client/models/cluster_environment.py +380 -0
  885. anyscale/sdk/anyscale_client/models/cluster_environment_build.py +578 -0
  886. anyscale/sdk/anyscale_client/models/cluster_environment_build_log_response.py +123 -0
  887. anyscale/sdk/anyscale_client/models/cluster_environment_build_operation.py +237 -0
  888. anyscale/sdk/anyscale_client/models/cluster_environment_build_status.py +104 -0
  889. anyscale/sdk/anyscale_client/models/cluster_environments_query.py +290 -0
  890. anyscale/sdk/anyscale_client/models/cluster_head_node_info.py +152 -0
  891. anyscale/sdk/anyscale_client/models/cluster_list_response.py +147 -0
  892. anyscale/sdk/anyscale_client/models/cluster_management_stack_versions.py +100 -0
  893. anyscale/sdk/anyscale_client/models/cluster_operation.py +266 -0
  894. anyscale/sdk/anyscale_client/models/cluster_operation_type.py +101 -0
  895. anyscale/sdk/anyscale_client/models/cluster_response.py +121 -0
  896. anyscale/sdk/anyscale_client/models/cluster_services_urls.py +430 -0
  897. anyscale/sdk/anyscale_client/models/cluster_state.py +108 -0
  898. anyscale/sdk/anyscale_client/models/cluster_status.py +104 -0
  899. anyscale/sdk/anyscale_client/models/cluster_status_details.py +100 -0
  900. anyscale/sdk/anyscale_client/models/clustercompute_list_response.py +147 -0
  901. anyscale/sdk/anyscale_client/models/clustercompute_response.py +121 -0
  902. anyscale/sdk/anyscale_client/models/clusterenvironment_list_response.py +147 -0
  903. anyscale/sdk/anyscale_client/models/clusterenvironment_response.py +121 -0
  904. anyscale/sdk/anyscale_client/models/clusterenvironmentbuild_list_response.py +147 -0
  905. anyscale/sdk/anyscale_client/models/clusterenvironmentbuild_response.py +121 -0
  906. anyscale/sdk/anyscale_client/models/clusterenvironmentbuildlogresponse_response.py +121 -0
  907. anyscale/sdk/anyscale_client/models/clusterenvironmentbuildoperation_response.py +121 -0
  908. anyscale/sdk/anyscale_client/models/clusteroperation_response.py +121 -0
  909. anyscale/sdk/anyscale_client/models/clusters_query.py +234 -0
  910. anyscale/sdk/anyscale_client/models/compute_node_type.py +292 -0
  911. anyscale/sdk/anyscale_client/models/compute_stack.py +100 -0
  912. anyscale/sdk/anyscale_client/models/compute_template.py +415 -0
  913. anyscale/sdk/anyscale_client/models/compute_template_config.py +461 -0
  914. anyscale/sdk/anyscale_client/models/compute_template_query.py +316 -0
  915. anyscale/sdk/anyscale_client/models/computetemplate_list_response.py +147 -0
  916. anyscale/sdk/anyscale_client/models/computetemplate_response.py +121 -0
  917. anyscale/sdk/anyscale_client/models/computetemplateconfig_response.py +121 -0
  918. anyscale/sdk/anyscale_client/models/create_app_config.py +235 -0
  919. anyscale/sdk/anyscale_client/models/create_app_config_configuration_schema.py +235 -0
  920. anyscale/sdk/anyscale_client/models/create_build.py +263 -0
  921. anyscale/sdk/anyscale_client/models/create_byod_app_config_configuration_schema.py +206 -0
  922. anyscale/sdk/anyscale_client/models/create_byod_cluster_environment.py +180 -0
  923. anyscale/sdk/anyscale_client/models/create_byod_cluster_environment_build.py +152 -0
  924. anyscale/sdk/anyscale_client/models/create_byod_cluster_environment_configuration_schema.py +208 -0
  925. anyscale/sdk/anyscale_client/models/create_cloud.py +518 -0
  926. anyscale/sdk/anyscale_client/models/create_cluster.py +376 -0
  927. anyscale/sdk/anyscale_client/models/create_cluster_compute.py +229 -0
  928. anyscale/sdk/anyscale_client/models/create_cluster_compute_config.py +463 -0
  929. anyscale/sdk/anyscale_client/models/create_cluster_environment.py +235 -0
  930. anyscale/sdk/anyscale_client/models/create_cluster_environment_build.py +263 -0
  931. anyscale/sdk/anyscale_client/models/create_cluster_environment_configuration_schema.py +235 -0
  932. anyscale/sdk/anyscale_client/models/create_compute_template.py +229 -0
  933. anyscale/sdk/anyscale_client/models/create_compute_template_config.py +464 -0
  934. anyscale/sdk/anyscale_client/models/create_job_queue_config.py +206 -0
  935. anyscale/sdk/anyscale_client/models/create_production_job.py +234 -0
  936. anyscale/sdk/anyscale_client/models/create_production_job_config.py +347 -0
  937. anyscale/sdk/anyscale_client/models/create_project.py +207 -0
  938. anyscale/sdk/anyscale_client/models/create_schedule.py +263 -0
  939. anyscale/sdk/anyscale_client/models/create_session.py +432 -0
  940. anyscale/sdk/anyscale_client/models/create_session_command.py +152 -0
  941. anyscale/sdk/anyscale_client/models/create_sso_config.py +150 -0
  942. anyscale/sdk/anyscale_client/models/grpc_protocol_config.py +178 -0
  943. anyscale/sdk/anyscale_client/models/ha_job_goal_states.py +102 -0
  944. anyscale/sdk/anyscale_client/models/ha_job_states.py +109 -0
  945. anyscale/sdk/anyscale_client/models/http_protocol_config.py +150 -0
  946. anyscale/sdk/anyscale_client/models/http_validation_error.py +120 -0
  947. anyscale/sdk/anyscale_client/models/idle_termination_status.py +104 -0
  948. anyscale/sdk/anyscale_client/models/job.py +466 -0
  949. anyscale/sdk/anyscale_client/models/job_list_response.py +147 -0
  950. anyscale/sdk/anyscale_client/models/job_queue_config.py +122 -0
  951. anyscale/sdk/anyscale_client/models/job_queue_execution_mode.py +101 -0
  952. anyscale/sdk/anyscale_client/models/job_queue_spec.py +263 -0
  953. anyscale/sdk/anyscale_client/models/job_run_type.py +101 -0
  954. anyscale/sdk/anyscale_client/models/job_status.py +105 -0
  955. anyscale/sdk/anyscale_client/models/jobs_query.py +458 -0
  956. anyscale/sdk/anyscale_client/models/jobs_sort_field.py +104 -0
  957. anyscale/sdk/anyscale_client/models/list_response_metadata.py +146 -0
  958. anyscale/sdk/anyscale_client/models/list_service_model.py +347 -0
  959. anyscale/sdk/anyscale_client/models/listservicemodel_list_response.py +147 -0
  960. anyscale/sdk/anyscale_client/models/log_download_result.py +207 -0
  961. anyscale/sdk/anyscale_client/models/log_file_chunk.py +439 -0
  962. anyscale/sdk/anyscale_client/models/log_level_types.py +100 -0
  963. anyscale/sdk/anyscale_client/models/log_stream.py +151 -0
  964. anyscale/sdk/anyscale_client/models/logdownloadresult_response.py +121 -0
  965. anyscale/sdk/anyscale_client/models/logstream_response.py +121 -0
  966. anyscale/sdk/anyscale_client/models/node_type.py +100 -0
  967. anyscale/sdk/anyscale_client/models/object_storage_config.py +122 -0
  968. anyscale/sdk/anyscale_client/models/object_storage_config_s3.py +256 -0
  969. anyscale/sdk/anyscale_client/models/objectstorageconfig_response.py +121 -0
  970. anyscale/sdk/anyscale_client/models/operation_error.py +123 -0
  971. anyscale/sdk/anyscale_client/models/operation_progress.py +123 -0
  972. anyscale/sdk/anyscale_client/models/operation_result.py +150 -0
  973. anyscale/sdk/anyscale_client/models/organization.py +209 -0
  974. anyscale/sdk/anyscale_client/models/organization_response.py +121 -0
  975. anyscale/sdk/anyscale_client/models/page_query.py +153 -0
  976. anyscale/sdk/anyscale_client/models/pause_schedule.py +123 -0
  977. anyscale/sdk/anyscale_client/models/production_job.py +437 -0
  978. anyscale/sdk/anyscale_client/models/production_job_config.py +348 -0
  979. anyscale/sdk/anyscale_client/models/production_job_state_transition.py +293 -0
  980. anyscale/sdk/anyscale_client/models/production_service_v2_model.py +612 -0
  981. anyscale/sdk/anyscale_client/models/production_service_v2_version_model.py +437 -0
  982. anyscale/sdk/anyscale_client/models/productionjob_list_response.py +147 -0
  983. anyscale/sdk/anyscale_client/models/productionjob_response.py +121 -0
  984. anyscale/sdk/anyscale_client/models/productionservicev2_model_response.py +121 -0
  985. anyscale/sdk/anyscale_client/models/project.py +467 -0
  986. anyscale/sdk/anyscale_client/models/project_list_response.py +147 -0
  987. anyscale/sdk/anyscale_client/models/project_response.py +121 -0
  988. anyscale/sdk/anyscale_client/models/projects_query.py +234 -0
  989. anyscale/sdk/anyscale_client/models/protocols.py +150 -0
  990. anyscale/sdk/anyscale_client/models/python_modules.py +150 -0
  991. anyscale/sdk/anyscale_client/models/python_version.py +105 -0
  992. anyscale/sdk/anyscale_client/models/ray_gcs_external_storage_config.py +178 -0
  993. anyscale/sdk/anyscale_client/models/ray_runtime_env_config.py +262 -0
  994. anyscale/sdk/anyscale_client/models/resources.py +234 -0
  995. anyscale/sdk/anyscale_client/models/rollback_service_model.py +122 -0
  996. anyscale/sdk/anyscale_client/models/rollout_strategy.py +100 -0
  997. anyscale/sdk/anyscale_client/models/runtime_environment.py +406 -0
  998. anyscale/sdk/anyscale_client/models/runtimeenvironment_response.py +121 -0
  999. anyscale/sdk/anyscale_client/models/schedule_api_model.py +467 -0
  1000. anyscale/sdk/anyscale_client/models/schedule_config.py +151 -0
  1001. anyscale/sdk/anyscale_client/models/scheduleapimodel_list_response.py +147 -0
  1002. anyscale/sdk/anyscale_client/models/scheduleapimodel_response.py +121 -0
  1003. anyscale/sdk/anyscale_client/models/service_config.py +178 -0
  1004. anyscale/sdk/anyscale_client/models/service_event_current_state.py +108 -0
  1005. anyscale/sdk/anyscale_client/models/service_goal_states.py +100 -0
  1006. anyscale/sdk/anyscale_client/models/service_model.py +612 -0
  1007. anyscale/sdk/anyscale_client/models/service_observability_urls.py +206 -0
  1008. anyscale/sdk/anyscale_client/models/service_sort_field.py +101 -0
  1009. anyscale/sdk/anyscale_client/models/service_type.py +100 -0
  1010. anyscale/sdk/anyscale_client/models/service_version_state.py +106 -0
  1011. anyscale/sdk/anyscale_client/models/servicemodel_list_response.py +147 -0
  1012. anyscale/sdk/anyscale_client/models/servicemodel_response.py +121 -0
  1013. anyscale/sdk/anyscale_client/models/session.py +1535 -0
  1014. anyscale/sdk/anyscale_client/models/session_command.py +350 -0
  1015. anyscale/sdk/anyscale_client/models/session_command_types.py +100 -0
  1016. anyscale/sdk/anyscale_client/models/session_event.py +267 -0
  1017. anyscale/sdk/anyscale_client/models/session_event_cause.py +150 -0
  1018. anyscale/sdk/anyscale_client/models/session_event_types.py +111 -0
  1019. anyscale/sdk/anyscale_client/models/session_list_response.py +147 -0
  1020. anyscale/sdk/anyscale_client/models/session_operation.py +266 -0
  1021. anyscale/sdk/anyscale_client/models/session_operation_type.py +101 -0
  1022. anyscale/sdk/anyscale_client/models/session_response.py +121 -0
  1023. anyscale/sdk/anyscale_client/models/session_starting_up_data.py +146 -0
  1024. anyscale/sdk/anyscale_client/models/session_state.py +111 -0
  1025. anyscale/sdk/anyscale_client/models/session_state_data.py +146 -0
  1026. anyscale/sdk/anyscale_client/models/session_stopping_data.py +146 -0
  1027. anyscale/sdk/anyscale_client/models/sessioncommand_list_response.py +147 -0
  1028. anyscale/sdk/anyscale_client/models/sessioncommand_response.py +121 -0
  1029. anyscale/sdk/anyscale_client/models/sessionevent_list_response.py +147 -0
  1030. anyscale/sdk/anyscale_client/models/sessionoperation_response.py +121 -0
  1031. anyscale/sdk/anyscale_client/models/sessions_query.py +206 -0
  1032. anyscale/sdk/anyscale_client/models/sort_by_clause_jobs_sort_field.py +148 -0
  1033. anyscale/sdk/anyscale_client/models/sort_order.py +100 -0
  1034. anyscale/sdk/anyscale_client/models/sso_config.py +237 -0
  1035. anyscale/sdk/anyscale_client/models/sso_mode.py +101 -0
  1036. anyscale/sdk/anyscale_client/models/ssoconfig_response.py +121 -0
  1037. anyscale/sdk/anyscale_client/models/start_cluster_options.py +178 -0
  1038. anyscale/sdk/anyscale_client/models/start_session_options.py +206 -0
  1039. anyscale/sdk/anyscale_client/models/static_sso_config.py +210 -0
  1040. anyscale/sdk/anyscale_client/models/supportedbaseimagesenum.py +1570 -0
  1041. anyscale/sdk/anyscale_client/models/terminate_cluster_options.py +122 -0
  1042. anyscale/sdk/anyscale_client/models/terminate_session_options.py +206 -0
  1043. anyscale/sdk/anyscale_client/models/text_query.py +178 -0
  1044. anyscale/sdk/anyscale_client/models/tracing_config.py +178 -0
  1045. anyscale/sdk/anyscale_client/models/update_app_config.py +122 -0
  1046. anyscale/sdk/anyscale_client/models/update_cloud.py +150 -0
  1047. anyscale/sdk/anyscale_client/models/update_cluster.py +206 -0
  1048. anyscale/sdk/anyscale_client/models/update_compute_template.py +146 -0
  1049. anyscale/sdk/anyscale_client/models/update_compute_template_config.py +464 -0
  1050. anyscale/sdk/anyscale_client/models/update_organization.py +123 -0
  1051. anyscale/sdk/anyscale_client/models/update_project.py +150 -0
  1052. anyscale/sdk/anyscale_client/models/update_session.py +150 -0
  1053. anyscale/sdk/anyscale_client/models/user_service_access_types.py +100 -0
  1054. anyscale/sdk/anyscale_client/models/ux_instance.py +468 -0
  1055. anyscale/sdk/anyscale_client/models/validation_error.py +175 -0
  1056. anyscale/sdk/anyscale_client/models/worker_node_type.py +404 -0
  1057. anyscale/sdk/anyscale_client/rest.py +296 -0
  1058. anyscale/sdk/anyscale_client/sdk.py +634 -0
  1059. anyscale/service/__init__.py +168 -0
  1060. anyscale/service/_private/service_sdk.py +702 -0
  1061. anyscale/service/commands.py +261 -0
  1062. anyscale/service/models.py +671 -0
  1063. anyscale/shared_anyscale_utils/__init__.py +1 -0
  1064. anyscale/shared_anyscale_utils/aws.py +153 -0
  1065. anyscale/shared_anyscale_utils/bytes_util.py +10 -0
  1066. anyscale/shared_anyscale_utils/conf.py +47 -0
  1067. anyscale/shared_anyscale_utils/default_anyscale_aws.yaml +74 -0
  1068. anyscale/shared_anyscale_utils/default_anyscale_gcp.yaml +80 -0
  1069. anyscale/shared_anyscale_utils/headers.py +38 -0
  1070. anyscale/shared_anyscale_utils/latest_ray_version.py +2 -0
  1071. anyscale/shared_anyscale_utils/project.py +15 -0
  1072. anyscale/shared_anyscale_utils/test_util.py +22 -0
  1073. anyscale/shared_anyscale_utils/tests/__init__.py +1 -0
  1074. anyscale/shared_anyscale_utils/tests/test_asyncio.py +41 -0
  1075. anyscale/shared_anyscale_utils/tests/test_ray_semver.py +63 -0
  1076. anyscale/shared_anyscale_utils/util.py +50 -0
  1077. anyscale/shared_anyscale_utils/utils/__init__.py +2 -0
  1078. anyscale/shared_anyscale_utils/utils/asyncio.py +120 -0
  1079. anyscale/shared_anyscale_utils/utils/byod.py +40 -0
  1080. anyscale/shared_anyscale_utils/utils/collections.py +33 -0
  1081. anyscale/shared_anyscale_utils/utils/id_gen.py +147 -0
  1082. anyscale/shared_anyscale_utils/utils/protected_string.py +89 -0
  1083. anyscale/shared_anyscale_utils/utils/ray_semver.py +81 -0
  1084. anyscale/snapshot.py +46 -0
  1085. anyscale/tables.py +82 -0
  1086. anyscale/util.py +1155 -0
  1087. anyscale/utils/__init__.py +0 -0
  1088. anyscale/utils/cli_version_check_util.py +63 -0
  1089. anyscale/utils/cloud_update_utils.py +862 -0
  1090. anyscale/utils/cloud_utils.py +317 -0
  1091. anyscale/utils/cluster_debug.py +191 -0
  1092. anyscale/utils/connect_helpers.py +155 -0
  1093. anyscale/utils/deprecation_util.py +32 -0
  1094. anyscale/utils/entity_arg_utils.py +43 -0
  1095. anyscale/utils/env_utils.py +17 -0
  1096. anyscale/utils/gcp_managed_setup_utils.py +888 -0
  1097. anyscale/utils/gcp_utils.py +312 -0
  1098. anyscale/utils/imports/__init__.py +0 -0
  1099. anyscale/utils/imports/all.py +13 -0
  1100. anyscale/utils/imports/azure.py +14 -0
  1101. anyscale/utils/imports/gcp.py +59 -0
  1102. anyscale/utils/logs_utils.py +141 -0
  1103. anyscale/utils/name_utils.py +33 -0
  1104. anyscale/utils/network_verification.py +153 -0
  1105. anyscale/utils/ray_utils.py +128 -0
  1106. anyscale/utils/ray_version_checker.py +48 -0
  1107. anyscale/utils/ray_version_utils.py +53 -0
  1108. anyscale/utils/runtime_env.py +487 -0
  1109. anyscale/utils/s3.py +92 -0
  1110. anyscale/utils/user_utils.py +17 -0
  1111. anyscale/utils/workload_types.py +7 -0
  1112. anyscale/utils/workspace_notification.py +39 -0
  1113. anyscale/utils/workspace_utils.py +65 -0
  1114. anyscale/version.py +1 -0
  1115. anyscale/webterminal/__init__.py +0 -0
  1116. anyscale/webterminal/bash-preexec.sh +370 -0
  1117. anyscale/webterminal/command_persister.py +164 -0
  1118. anyscale/webterminal/utils.py +176 -0
  1119. anyscale/webterminal/webterminal.py +311 -0
  1120. anyscale/workspace/__init__.py +270 -0
  1121. anyscale/workspace/_private/workspace_sdk.py +737 -0
  1122. anyscale/workspace/commands.py +472 -0
  1123. anyscale/workspace/models.py +296 -0
  1124. anyscale/workspace_utils.py +35 -0
  1125. anyscale-0.24.86.dist-info/LICENSE +68 -0
  1126. anyscale-0.24.86.dist-info/METADATA +82 -0
  1127. anyscale-0.24.86.dist-info/NOTICE +6 -0
  1128. anyscale-0.24.86.dist-info/RECORD +1131 -0
  1129. anyscale-0.24.86.dist-info/WHEEL +5 -0
  1130. anyscale-0.24.86.dist-info/entry_points.txt +2 -0
  1131. anyscale-0.24.86.dist-info/top_level.txt +1 -0
anyscale/connect.py ADDED
@@ -0,0 +1,1323 @@
1
+ """Anyscale connect implementation.
2
+
3
+ Here's an overview of how a connect call works. It goes through a few steps:
4
+ 1. Detecting the project and comparing build_id and compute_template_id
5
+ 2. Getting or creating a cluster if necessary.
6
+ 3. Acquiring a cluster lock via the Ray client (when not in multiclients mode)
7
+
8
+ Detecting the project: The project may be specified explicitly or
9
+ autodetected based on an initialized anyscale project in the
10
+ current working directory or one of its ancestor directories.
11
+ Otherwise the default project for the organization will be used.
12
+
13
+ Getting or creating a cluster: If a cluster name is passed in, anyscale
14
+ will start a cluster with that name unless the cluster is already running.
15
+ If the cluster is already running we compare the new cluster env build_id and
16
+ compute_template_id with the new cluster, if they match we connect, if they do
17
+ not match, we fail and require explicitly updating the cluster.
18
+
19
+ By default, multiple clients can connect to a cluster. If you want to
20
+ explicitly disable multiple client connects, set
21
+ ANYSCALE_ALLOW_MULTIPLE_CLIENTS=0 in the environment.
22
+ """
23
+
24
+ import copy
25
+ from datetime import datetime, timezone
26
+ import inspect
27
+ import os
28
+ from pathlib import Path
29
+ import shlex
30
+ import subprocess
31
+ import sys
32
+ from types import ModuleType
33
+ from typing import Any, Dict, List, Optional, Tuple, Union
34
+ from urllib.parse import parse_qs, urlparse
35
+
36
+ from packaging import version
37
+ import requests
38
+ import yaml
39
+
40
+ from anyscale.api import configure_open_api_client_headers
41
+ from anyscale.authenticate import AuthenticationBlock, get_auth_api_client
42
+ from anyscale.cli_logger import BlockLogger
43
+ from anyscale.client.openapi_client.models.session import Session
44
+ from anyscale.conf import MINIMUM_RAY_VERSION
45
+ from anyscale.connect_utils.prepare_cluster import create_prepare_cluster_block
46
+ from anyscale.connect_utils.project import create_project_block
47
+ from anyscale.connect_utils.start_interactive_session import ( # pylint:disable=private-import
48
+ _get_interactive_shell_frame,
49
+ start_interactive_session_block,
50
+ )
51
+ import anyscale.project
52
+ from anyscale.sdk.anyscale_client.sdk import AnyscaleSDK
53
+ from anyscale.shared_anyscale_utils.util import slugify
54
+ from anyscale.util import PROJECT_NAME_ENV_VAR
55
+ from anyscale.utils.connect_helpers import AnyscaleClientContext, get_cluster
56
+
57
+
58
+ # Max number of auto created clusters.
59
+ MAX_CLUSTERS = 40
60
+
61
+ # The paths to exclude when syncing the working directory in runtime env.
62
+ EXCLUDE_DIRS = [".git", "__pycache__", "venv"]
63
+ EXCLUDE_PATHS = [".anyscale.yaml", "session-default.yaml"]
64
+
65
+ # The type of the dict that can be passed to create a cluster env.
66
+ # e.g., {"base_image": "anyscale/ray-ml:1.1.0-gpu"}
67
+ CLUSTER_ENV_DICT_TYPE = Dict[str, Union[str, List[str]]]
68
+
69
+ # The cluster compute type. It can either be a string, eg my_template or a dict,
70
+ # eg, {"cloud_id": "id-123" ...}
71
+ CLUSTER_COMPUTE_DICT_TYPE = Dict[str, Any]
72
+
73
+ # Commands used to build Ray from source. Note that intermediate stages will
74
+ # be cached by the app config builder.
75
+ BUILD_STEPS = [
76
+ "git clone https://github.com/ray-project/ray.git",
77
+ "curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg",
78
+ "sudo mv bazel.gpg /etc/apt/trusted.gpg.d/",
79
+ 'echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list',
80
+ "sudo apt-get update && sudo apt-get install -y bazel=3.2.0",
81
+ 'cd ray/python && sudo env "PATH=$PATH" python setup.py develop',
82
+ "pip uninstall -y ray",
83
+ ]
84
+
85
+
86
+ # Default docker images to use for connect clusters.
87
+ def _get_base_image(image: str, ray_version: str, cpu_or_gpu: str) -> str:
88
+ py_version = "".join(str(x) for x in sys.version_info[0:2])
89
+ if sys.version_info.major == 3 and sys.version_info.minor == 10:
90
+ py_version = "310"
91
+ if py_version not in ["36", "37", "38", "39", "310"]:
92
+ raise ValueError(f"No default docker image for py{py_version}")
93
+ return f"anyscale/{image}:{ray_version}-py{py_version}-{cpu_or_gpu}"
94
+
95
+
96
+ def _is_in_shell(frames: Optional[List[Any]] = None) -> bool:
97
+ """
98
+ Determines whether we are in a Notebook / shell.
99
+ This is done by inspecting the first non-Anyscale related frame.
100
+ If this is from an interactive terminal it will be either STDIN or IPython's Input.
101
+ If connect() is being run from a file (like python myscript.py), frame.filename will equal "myscript.py".
102
+ """
103
+ fr = _get_interactive_shell_frame(frames)
104
+
105
+ if fr is None:
106
+ return False
107
+
108
+ is_ipython = fr.filename.startswith("<ipython-input") and fr.filename.endswith(">")
109
+ is_regular_python_shell: bool = fr.filename == "<stdin>"
110
+ return is_regular_python_shell or is_ipython
111
+
112
+
113
+ def _is_running_on_anyscale_cluster() -> bool:
114
+ return "ANYSCALE_SESSION_ID" in os.environ
115
+
116
+
117
+ def _redact_token(token: str) -> str:
118
+ """Preserve a short prefix of the token, redact other characters."""
119
+ preserve = 8
120
+ n = len(token)
121
+ if n <= preserve:
122
+ return token
123
+ redacted_len = 16
124
+ return token[:preserve] + ("*" * (redacted_len - preserve))
125
+
126
+
127
+ class ClientBuilder:
128
+ """This class lets you set cluster options and connect to Anyscale.
129
+
130
+ It should not be constructed directly, but instead via ray.init("anyscale://") arguments
131
+ exported at the package level.
132
+
133
+ Examples:
134
+ >>> # Raw client, creates new cluster on behalf of user
135
+ >>> ray.init("anyscale://")
136
+
137
+ >>> # Get or create a named cluster
138
+ >>> ray.init("anyscale://my_named_cluster")
139
+
140
+ >>> # Specify a previously created cluster environment
141
+ >>> ray.init(
142
+ ... "anyscale://<cluster-name>?cluster_compute=compute:1",
143
+ ... cluster_env="prev_created_config:2",
144
+ ... autosuspend="2h")
145
+
146
+ >>> # Create new cluster from local env / from scratch
147
+ >>> ray.init("anyscale://<cluster-name>",
148
+ ... runtime_env={"working_dir": "~/dev/my-project-folder"}
149
+ ... )
150
+
151
+ >>> # Ray client connect is setup automatically
152
+ >>> @ray.remote
153
+ ... def my_func(value):
154
+ ... return value ** 2
155
+
156
+ >>> # Remote functions are executed in the Anyscale cluster
157
+ >>> print(ray.get([my_func.remote(x) for x in range(5)]))
158
+ >>> [0, 1, 4, 9, 16]
159
+ """
160
+
161
+ def __init__( # noqa: PLR0912
162
+ self,
163
+ address: Optional[str] = None,
164
+ anyscale_sdk: AnyscaleSDK = None,
165
+ subprocess: ModuleType = subprocess,
166
+ requests: ModuleType = requests,
167
+ _ray: Optional[ModuleType] = None,
168
+ log: Optional[Any] = None,
169
+ _os: ModuleType = os,
170
+ _ignore_version_check: bool = False,
171
+ auth_api_client: Optional[AuthenticationBlock] = None,
172
+ ) -> None:
173
+
174
+ # Class dependencies.
175
+ self._anyscale_sdk: AnyscaleSDK = None
176
+ self._credentials = None
177
+ if auth_api_client is None:
178
+ auth_api_client = get_auth_api_client()
179
+ if log:
180
+ self._log = log
181
+ else:
182
+ self._log = BlockLogger()
183
+ if anyscale_sdk:
184
+ self._anyscale_sdk = anyscale_sdk
185
+ else:
186
+ self._credentials = auth_api_client.credentials
187
+ self._log.debug(
188
+ "Using host {}".format(
189
+ anyscale.shared_anyscale_utils.conf.ANYSCALE_HOST
190
+ )
191
+ )
192
+ redacted_token = _redact_token(self._credentials)
193
+ self._log.debug(f"Using credentials {redacted_token}")
194
+ self._anyscale_sdk = AnyscaleSDK(
195
+ self._credentials, anyscale.shared_anyscale_utils.conf.ANYSCALE_HOST,
196
+ )
197
+ configure_open_api_client_headers(self._anyscale_sdk.api_client, "connect")
198
+ api_client = auth_api_client.api_client
199
+
200
+ configure_open_api_client_headers(api_client.api_client, "connect")
201
+ anyscale_api_client = auth_api_client.anyscale_api_client
202
+ self._api_client = api_client
203
+ self._anyscale_api_client = anyscale_api_client
204
+ if not _ray:
205
+ try:
206
+ import ray
207
+
208
+ # Workaround for older versions of with ray that don't have the
209
+ # fix for: https://github.com/ray-project/ray/issues/19840
210
+ from ray.autoscaler import sdk # noqa
211
+ except ModuleNotFoundError:
212
+ raise RuntimeError(
213
+ "Ray is not installed. Please install with: \n"
214
+ "pip install -U --force-reinstall `python -m anyscale.connect required_ray_version`"
215
+ )
216
+ _ray = ray
217
+ self._ray: Any = _ray
218
+ self._subprocess: Any = subprocess
219
+ self._os: Any = _os
220
+ self._requests: Any = requests
221
+ self._in_shell = _is_in_shell()
222
+
223
+ self._log.open_block("ParseArgs", block_title="Parsing Ray Client arguments")
224
+
225
+ # Environment variables
226
+ # If we are running in an anyscale cluster, or IGNORE_VERSION_CHECK is set,
227
+ # skip the pinned versions
228
+ if "IGNORE_VERSION_CHECK" in os.environ or _is_running_on_anyscale_cluster():
229
+ _ignore_version_check = True
230
+ self._ignore_version_check = _ignore_version_check
231
+
232
+ if os.environ.get("ANYSCALE_COMPUTE_CONFIG") == "1":
233
+ self._log.info(
234
+ "All anyscale.connect clusters will be started with compute configs so "
235
+ "ANYSCALE_COMPUTE_CONFIG=1 no longer needs to be specified."
236
+ )
237
+
238
+ # Determines whether the gRPC connection the server will be over SSL.
239
+ self._secure: bool = os.environ.get("ANYSCALE_CONNECT_SECURE") != "0"
240
+ if not self._secure:
241
+ self._log.warning(
242
+ "The connection between your machine and the cluster is *NOT* encrypted "
243
+ "because the environment variable `ANYSCALE_CONNECT_SECURE=0` was specified. "
244
+ "This is not recommended and will be deprecated in the near future."
245
+ )
246
+
247
+ # Builder args.
248
+ self._project_dir: Optional[str] = None
249
+ self._project_name: Optional[str] = None
250
+ self._cloud_name: Optional[str] = None
251
+ self._cluster_name: Optional[str] = None
252
+ self._requirements: Optional[str] = None
253
+ self._cluster_compute_name: Optional[str] = None
254
+ self._cluster_compute_dict: Optional[CLUSTER_COMPUTE_DICT_TYPE] = None
255
+ self._cluster_env_name: Optional[str] = None
256
+ self._cluster_env_dict: Optional[CLUSTER_ENV_DICT_TYPE] = None
257
+ self._cluster_env_revision: Optional[int] = None
258
+ self._initial_scale: List[Dict[str, float]] = []
259
+ # Will be overwritten to DEFAULT_AUTOSUSPEND_TIMEOUT if not set by user.
260
+ self._autosuspend_timeout: Optional[int] = None
261
+ self._run_mode: Optional[str] = None
262
+ self._build_commit: Optional[str] = None
263
+ self._build_pr: Optional[int] = None
264
+ self._force_rebuild: bool = False
265
+ self._job_config = self._ray.job_config.JobConfig()
266
+ self._user_runtime_env: Dict[str, Any] = {}
267
+ self._allow_public_internet_traffic: Optional[bool] = None
268
+ self._ray_init_kwargs: Dict[str, Any] = {}
269
+ # Override default run mode.
270
+ if "ANYSCALE_LOCAL_DOCKER" in os.environ:
271
+ self._run_mode = "local_docker"
272
+ self._log.debug(
273
+ "Using `run_mode=local_docker` since ANYSCALE_LOCAL_DOCKER is set"
274
+ )
275
+
276
+ # Whether to update the cluster when connecting to a fixed cluster.
277
+ self._needs_update: bool = True
278
+ self._parse_address(address)
279
+
280
+ def _parse_cluster_project_name_in_address(self, address: str) -> Tuple[str, str]:
281
+ """
282
+ Parses cluster and project names from connection string as follows:
283
+ address = "name1/name2" --> project_name = "name1", cluster_name = "name2"
284
+ address = "name1/" --> project_name = "name1"
285
+ address = "name1" --> cluster_name = "name1"
286
+ Returns (project_name, cluster_name)
287
+ """
288
+ split_address = address.split("/")
289
+ if len(split_address) == 1:
290
+ # No "/" in address
291
+ project_name = ""
292
+ cluster_name = split_address[0]
293
+ elif len(split_address) == 2:
294
+ project_name = split_address[0]
295
+ cluster_name = split_address[1]
296
+ else:
297
+ raise ValueError(
298
+ f"The connection string `anyscale://{address}` has multiple subpaths. "
299
+ "Please make sure the connection string is of the format `anyscale://project_name/cluster_name`."
300
+ )
301
+ return project_name, cluster_name
302
+
303
+ def _parse_address(self, address: Optional[str]) -> None:
304
+ """
305
+ DEPRECATED, should be removed after deprecating the client builder.
306
+ Parses the anyscale address and sets parameters on this builder.
307
+ Eg, address="<cluster-name>?cluster_compute=my_template&autosuspend=5&cluster_env=bla:1&update=True
308
+ """
309
+
310
+ # The supported parameters that we can provide in the url.
311
+ # e.g url="anyscale://ameer?param1=val1&param2=val2"
312
+ CONNECT_URL_PARAMS = ["cluster_compute", "cluster_env", "autosuspend", "update"]
313
+
314
+ self._project_name = os.environ.get(PROJECT_NAME_ENV_VAR)
315
+
316
+ if address is None or not address:
317
+ return
318
+ parsed_result = urlparse(address)
319
+
320
+ # Parse the cluster name. e.g., what is before the question mark in the url.
321
+ project_name, cluster_name = self._parse_cluster_project_name_in_address(
322
+ parsed_result.path
323
+ )
324
+ if cluster_name:
325
+ self.session(cluster_name)
326
+ self._project_name = project_name or self._project_name
327
+
328
+ # parse the parameters (what comes after the question mark)
329
+ # parsed_result.query here looks like "param1=val1&param2=val2"
330
+ # params_dict looks like:
331
+ # {'cluster_compute': ['my_template'], 'autosuspend': ['5'], 'cluster_env': ['bla:1']}.
332
+ params_dict: Dict[str, Any] = parse_qs(parsed_result.query)
333
+ for key, val in params_dict.items():
334
+ if key == "autosuspend":
335
+ self.autosuspend(minutes=int(val[0]))
336
+ elif key == "cluster_env":
337
+ self.cluster_env(val[0])
338
+ elif key == "cluster_compute":
339
+ self.cluster_compute(val[0])
340
+ elif key == "update":
341
+ self._needs_update = val[0] == "True" or val[0] == "true"
342
+ else:
343
+ raise ValueError(
344
+ "Provided parameter in the anyscale address is "
345
+ f"{key}. The supported parameters are: {CONNECT_URL_PARAMS}."
346
+ )
347
+
348
+ def _init_args(self, **kwargs) -> "ClientBuilder": # noqa: PLR0912
349
+ """
350
+ Accepts arguments from ray.init when called with anyscale protocol,
351
+ i.e. ray.init("anyscale://someCluster", arg1="thing", arg2="other").
352
+ Ignores and raises a warning on unknown argument names.
353
+
354
+ Arguments are set directly with method calls in _parse_arg_as_method.
355
+ """
356
+ unknown = []
357
+
358
+ # request_resources arguments
359
+ request_resources_cpus = kwargs.pop("request_cpus", None)
360
+ request_resources_gpus = kwargs.pop("request_gpus", None)
361
+ request_resources_bundles = kwargs.pop("request_bundles", None)
362
+
363
+ # build_from_source arguments
364
+ build_from_source_commit = kwargs.pop("git_commit", None)
365
+ build_from_source_pr_id = kwargs.pop("github_pr_id", None)
366
+ force_rebuild = kwargs.pop("force_rebuild", False)
367
+
368
+ # project_dir arguments
369
+ project_dir = kwargs.pop("project_dir", None)
370
+ project_name = kwargs.pop("project_name", None)
371
+
372
+ for arg_name, value in kwargs.items():
373
+ if self._parse_arg_as_method(arg_name, value):
374
+ continue
375
+ elif arg_name == "autosuspend":
376
+ self._parse_autosuspend(value)
377
+ elif arg_name == "update":
378
+ if not isinstance(value, bool):
379
+ # Extra cautious check -- make sure users don't pass
380
+ # None/"false" in
381
+ raise RuntimeError(
382
+ "The value passed for the `update` argument should "
383
+ f"be a boolean. Found {type(value)} instead."
384
+ )
385
+ self._needs_update = value
386
+ # Explicitly error on `num_cpus` and `num_gpus`, since it's likely
387
+ # user confused with `request_cpus` and `request_gpus`
388
+ elif arg_name == "num_cpus":
389
+ raise RuntimeError(
390
+ "Invalid argument `num_cpus` for anyscale client. Did "
391
+ "you mean `request_cpus`?"
392
+ )
393
+ elif arg_name == "num_gpus":
394
+ raise RuntimeError(
395
+ "Invalid argument `num_gpus` for anyscale client. Did "
396
+ "you mean `request_gpus`?"
397
+ )
398
+ elif arg_name == "allow_public_internet_traffic":
399
+ if not isinstance(value, bool):
400
+ raise RuntimeError(
401
+ "The value passed for the `allow_public_internet_traffic` argument should "
402
+ f"be a boolean. Found {type(value)} instead."
403
+ )
404
+ self._allow_public_internet_traffic = value
405
+ elif self._forward_argument(arg_name, value):
406
+ continue
407
+ else:
408
+ unknown.append(arg_name)
409
+
410
+ if unknown:
411
+ unknown_str = ", ".join(unknown)
412
+ self._log.warning(
413
+ f"Ignored, unsupported argument(s): {unknown_str}. This argument may not be "
414
+ f"supported on ray {self._ray.__version__}. Try upgrading to a newer ray version "
415
+ "or checking if this is a valid argument."
416
+ )
417
+
418
+ if (
419
+ request_resources_cpus
420
+ or request_resources_gpus
421
+ or request_resources_bundles
422
+ ):
423
+ self.request_resources(
424
+ num_cpus=request_resources_cpus,
425
+ num_gpus=request_resources_gpus,
426
+ bundles=request_resources_bundles,
427
+ )
428
+
429
+ if build_from_source_commit or build_from_source_pr_id:
430
+ self.build_from_source(
431
+ git_commit=build_from_source_commit,
432
+ github_pr_id=build_from_source_pr_id,
433
+ force_rebuild=force_rebuild,
434
+ )
435
+
436
+ if (
437
+ self._user_runtime_env is None
438
+ or self._user_runtime_env.get("working_dir") is None
439
+ ):
440
+ # This needs to be a warning message to not break users current usecases.
441
+ # https://groups.google.com/a/anyscale.com/g/field-eng/c/4dAdqw4ORwU/m/eLYCCWZICAAJ?utm_medium=email&utm_source=footer&pli=1
442
+ self._log.warning(
443
+ "No working_dir specified! Files will only be uploaded to the cluster if a working_dir is provided or a project is detected. In the future, files will only be uploaded if working_dir is provided. "
444
+ "To ensure files continue being imported going forward, set the working_dir in your runtime environment. "
445
+ "See https://docs.ray.io/en/latest/handling-dependencies.html#runtime-environments."
446
+ )
447
+
448
+ if project_dir:
449
+ self._log.warning(
450
+ "The project_dir argument is deprecated and will be removed in April 2022. Instead, use the "
451
+ "working_dir argument in a runtime environment. "
452
+ "See https://docs.ray.io/en/latest/handling-dependencies.html#runtime-environments. "
453
+ """Replace
454
+
455
+ ray.init("anyscale://...", project_dir=directory, ...)
456
+
457
+ with
458
+
459
+ ray.init("anyscale://...", runtime_env={"working_dir": directory}, ...)
460
+ """
461
+ )
462
+ self.project_dir(local_dir=project_dir, name=project_name)
463
+
464
+ return self
465
+
466
+ def _parse_autosuspend(self, value: Union[str, int]) -> None:
467
+ """parses the value of autosuspend provided by the user.
468
+
469
+ Autosuspend can be int interpreted as minutes or str -> "15m"/"2h" for 15 mins/2 hours.
470
+ This function exists because self.autosuspend is used in the deprecated client builder
471
+ (e.g., ray.client().autosuspend(...).connect()) and cannot be modified directly.
472
+ Once we completely deprecate the client builder the old self.autosuspend can be updated.
473
+ """
474
+ if isinstance(value, str):
475
+ # Autosuspend can take strings like "15" (minutes), "15m", and "2h"
476
+ if value.endswith("m"):
477
+ self.autosuspend(minutes=int(value[:-1]))
478
+ elif value.endswith("h"):
479
+ self.autosuspend(hours=int(value[:-1]))
480
+ elif value == "-1": # Setting autosuspend to "-1" disables it.
481
+ self.autosuspend(enabled=False)
482
+ else:
483
+ self.autosuspend(minutes=int(value))
484
+ elif value == -1: # Setting autosuspend to -1 disables it.
485
+ self.autosuspend(enabled=False)
486
+ else:
487
+ self.autosuspend(minutes=value)
488
+
489
+ def _parse_arg_as_method(self, argument_name: str, argument_value: Any) -> bool:
490
+ """
491
+ Handle keyword arguments to ray.init that can be handled directly as
492
+ a method call. For example, init(cloud="value") can be handled
493
+ directly by self.cloud("value").
494
+
495
+ Args:
496
+ argument_name (str): Name of the argument (i.e. "cloud",
497
+ "autosuspend")
498
+ argument_value (Any): Corresponding value to the argument,
499
+ (i.e. "anyscale_default", "8h")
500
+
501
+ Returns:
502
+ True if the argument can be handled directly by a method, False
503
+ otherwise
504
+ """
505
+ if argument_name not in {
506
+ "cloud",
507
+ "cluster_compute",
508
+ "cluster_env",
509
+ "job_name",
510
+ "namespace",
511
+ "runtime_env",
512
+ "run_mode",
513
+ }:
514
+ return False
515
+ # convert argname: runtime_env -> env
516
+ # We want to use the `env` function here for backwards compatibility,
517
+ # but use `runtime_env` as the argument name since it's more clear
518
+ # and consistent with ray's APIs.
519
+ if argument_name == "runtime_env":
520
+ argument_name = "env"
521
+ getattr(self, argument_name)(argument_value)
522
+ return True
523
+
524
+ def _forward_argument(self, arg_name: str, value: Any) -> bool:
525
+ """
526
+ Fills self._ray_init_kwargs with any kwargs that match the signature of
527
+ the current ray version's ray.init method.
528
+
529
+ Returns True if the argument can be forwarded, false otherwise
530
+ """
531
+ connect_sig = inspect.signature(self._ray.util.connect)
532
+ if "ray_init_kwargs" not in connect_sig.parameters:
533
+ # Installed version of ray doesn't support forward init args
534
+ # through connect
535
+ return False
536
+
537
+ init_sig = inspect.signature(self._ray.init)
538
+ if arg_name in init_sig.parameters:
539
+ self._ray_init_kwargs[arg_name] = value
540
+ return True
541
+ return False
542
+
543
+ def env(self, runtime_env: Dict[str, Any]) -> "ClientBuilder":
544
+ """Sets the custom user specified runtime environment dict.
545
+
546
+ Args:
547
+ runtime_env (Dict[str, Any]): a python dictionary with runtime environment
548
+ specifications.
549
+
550
+ Examples:
551
+ >>> ray.init("anyscale://cluster_name", runtime_env={"pip": "./requirements.txt"})
552
+ >>> ray.init("anyscale://cluster_name",
553
+ ... runtime_env={"working_dir": "/tmp/bla", "pip": ["chess"]})
554
+ >>> ray.init("anyscale://cluster_name", runtime_env={"conda": "conda.yaml"})
555
+ """
556
+ if not isinstance(runtime_env, dict):
557
+ raise TypeError("runtime_env argument type should be dict.")
558
+ self._user_runtime_env = copy.deepcopy(runtime_env)
559
+ return self
560
+
561
+ def namespace(self, namespace: str) -> "ClientBuilder":
562
+ """Sets the namespace in the job config of the started job.
563
+
564
+ Args:
565
+ namespace (str): the name of to give to this namespace.
566
+
567
+ Example:
568
+ >> ray.init("anyscale://cluster_name", namespace="training_namespace")
569
+ """
570
+ self._job_config.set_ray_namespace(namespace)
571
+ return self
572
+
573
+ def job_name(self, job_name: Optional[str] = None) -> "ClientBuilder":
574
+ """Sets the job_name so the user can identify it in the UI.
575
+ This name is only used for display purposes in the UI.
576
+
577
+ Args:
578
+ job_name (str): the name of this job, which will be shown in the UI.
579
+
580
+ Example:
581
+ >>> ray.init("anyscale://cluster_name", job_name="production_job")
582
+ """
583
+ current_time_str = datetime.now(timezone.utc).strftime("%m-%d-%Y_%H:%M:%S")
584
+ if not job_name:
585
+ script_name = sys.argv[0]
586
+ if script_name:
587
+ job_name = f"{os.path.basename(script_name)}_{current_time_str}"
588
+ else:
589
+ job_name = f"Job_{current_time_str}"
590
+ self._job_config.set_metadata("job_name", job_name)
591
+ return self
592
+
593
+ def _rewrite_runtime_env_pip_as_list(self, runtime_env: Dict[str, Any]) -> None:
594
+ """Parses and replaces the "pip" field of runtime_env with a List[str] if present."""
595
+ if "pip" in runtime_env and isinstance(runtime_env["pip"], str):
596
+ # We have been given a path to a requirements.txt file.
597
+ pip_file = Path(runtime_env["pip"])
598
+ if not pip_file.is_file():
599
+ raise ValueError(f"{pip_file} is not a valid file")
600
+ runtime_env["pip"] = pip_file.read_text().strip().split("\n")
601
+
602
+ def _rewrite_runtime_env_conda_as_dict(self, runtime_env: Dict[str, Any]) -> None:
603
+ """Parses and replaces the "conda" field of runtime_env with a Dict if present."""
604
+ if "conda" in runtime_env and isinstance(runtime_env["conda"], str):
605
+ yaml_file = Path(runtime_env["conda"])
606
+ if yaml_file.suffix in (".yaml", ".yml"):
607
+ if not yaml_file.is_file():
608
+ raise ValueError(f"Can't find conda YAML file {yaml_file}.")
609
+ try:
610
+ runtime_env["conda"] = yaml.safe_load(yaml_file.read_text())
611
+ except Exception as e: # noqa: BLE001
612
+ raise ValueError(f"Failed to read conda file {yaml_file}: {e}.")
613
+
614
+ def _pin_protobuf_in_runtime_env_if_needed(
615
+ self, runtime_env: Dict[str, Any]
616
+ ) -> None:
617
+ """Pins protobuf to 3.20.1 in the "pip" and "conda" field for affected Ray versions.
618
+
619
+ See https://github.com/anyscale/product/issues/12007 for details.
620
+ """
621
+ # Since Ray 1.10.0, pip installs are incremental, so the cluster's protobuf version
622
+ # will be inherited and there's no need to add it to the "pip" field.
623
+ if version.parse(self._ray.__version__) < version.parse("1.10.0"):
624
+ self._rewrite_runtime_env_pip_as_list(runtime_env)
625
+ if "pip" in runtime_env and isinstance(runtime_env["pip"], list):
626
+ runtime_env["pip"].append("protobuf==3.20.1")
627
+
628
+ # Fixed in Ray starting with Ray 1.13.0:
629
+ # https://github.com/ray-project/ray/commit/6c8eb5e2ebde8db213ffb8722a0324077188e308
630
+ if version.parse(self._ray.__version__) < version.parse("1.13.0"):
631
+ self._rewrite_runtime_env_conda_as_dict(runtime_env)
632
+ if (
633
+ "conda" in runtime_env
634
+ and isinstance(runtime_env["conda"], dict)
635
+ and "dependencies" in runtime_env["conda"]
636
+ ):
637
+ for dep in runtime_env["conda"]["dependencies"]:
638
+ if (
639
+ isinstance(dep, dict)
640
+ and "pip" in dep
641
+ and isinstance(dep["pip"], list)
642
+ ):
643
+ dep["pip"].append("protobuf==3.20.1")
644
+
645
+ def _set_runtime_env_in_job_config(self, project_dir: Optional[str]) -> None:
646
+ """Configures the runtime env inside self._job_config.
647
+ project_dir is None if using the default project.
648
+ """
649
+
650
+ runtime_env = copy.deepcopy(self._user_runtime_env)
651
+
652
+ # There's no need to exclude files like ".anyscale.yaml"
653
+ # if using the default project.
654
+ project_dir_excludes = (
655
+ [os.path.join(project_dir, path) for path in EXCLUDE_PATHS]
656
+ if project_dir
657
+ else []
658
+ )
659
+
660
+ if "working_dir" not in runtime_env and project_dir:
661
+ # TODO(nikita): Remove logic of implying working dir from project dir
662
+ runtime_env["working_dir"] = project_dir
663
+ if "excludes" not in runtime_env:
664
+ runtime_env["excludes"] = []
665
+ runtime_env["excludes"] = (
666
+ EXCLUDE_DIRS + runtime_env["excludes"] + project_dir_excludes
667
+ )
668
+
669
+ # Patch for https://github.com/ray-project/ray/issues/20876
670
+ # If local pip or conda files are specified, read them here and rewrite
671
+ # the runtime env to prevent FileNotFoundError in the Ray Client server.
672
+ self._rewrite_runtime_env_pip_as_list(runtime_env)
673
+ self._rewrite_runtime_env_conda_as_dict(runtime_env)
674
+
675
+ self._pin_protobuf_in_runtime_env_if_needed(runtime_env)
676
+
677
+ self._job_config.set_runtime_env(runtime_env)
678
+
679
+ def _set_metadata_in_job_config(self, creator_id: Optional[str] = None) -> None:
680
+ """
681
+ Specify creator_id in job config. This is needed so the job
682
+ can correctly be created in the database. Specify default job name
683
+ if not user provided. This will be displayed in the UI.
684
+ """
685
+ # TODO(nikita): A customer can spoof this value and pretend to be someone else.
686
+ # Fix this once we have a plan for verification.
687
+ if creator_id is None:
688
+ user = self._api_client.get_user_info_api_v2_userinfo_get().result
689
+ creator_id = user.id
690
+
691
+ self._job_config.set_metadata("creator_id", creator_id)
692
+ if "job_name" not in self._job_config.metadata:
693
+ self.job_name()
694
+
695
+ def _fill_config_from_env(self, config_name: str) -> None:
696
+ """
697
+ Check if an environment variable corresponding to config_name is set,
698
+ and if so try to configure the connection using that value. For
699
+ example, if config_name is "job_name", then checks if the env var
700
+ ANYSCALE_JOB_NAME is set. If it is, the calls self.job_name() on the
701
+ value set for in the environment variable.
702
+ """
703
+ env_var_name = f"ANYSCALE_{config_name.upper()}"
704
+ if env_var_name in os.environ:
705
+ value = os.environ[env_var_name]
706
+ self._log.info(
707
+ f'Using "{value}" set in environment variable {env_var_name} to configure `{config_name}`.'
708
+ )
709
+ if config_name == "autosuspend":
710
+ self._parse_autosuspend(value)
711
+ else:
712
+ getattr(self, config_name)(value)
713
+
714
+ def _fill_unset_configs_from_env(self) -> None:
715
+ """
716
+ Fill unset configurations from environment variables. Currently
717
+ supports the following configs: cloud, cluster_compute, cluster_env,
718
+ job_name, and namespace.
719
+ """
720
+ if self._cloud_name is None:
721
+ self._fill_config_from_env("cloud")
722
+
723
+ # Only fill cluster_compute from environment if neither a name nor
724
+ # a dict was passed
725
+ cluster_compute_unset = (
726
+ self._cluster_compute_name is None and self._cluster_compute_dict is None
727
+ )
728
+ if cluster_compute_unset:
729
+ self._fill_config_from_env("cluster_compute")
730
+
731
+ # Only fill cluster_env if neither a name nor a dict was passed
732
+ cluster_env_unset = (
733
+ self._cluster_env_name is None and self._cluster_env_dict is None
734
+ )
735
+ if cluster_env_unset:
736
+ self._fill_config_from_env("cluster_env")
737
+
738
+ if self._autosuspend_timeout is None:
739
+ # override to env variable if available
740
+ self._fill_config_from_env("autosuspend")
741
+
742
+ if "job_name" not in self._job_config.metadata:
743
+ self._fill_config_from_env("job_name")
744
+
745
+ if self._job_config.ray_namespace is None:
746
+ self._fill_config_from_env("namespace")
747
+
748
+ def _bg_connect(self) -> Any:
749
+ """
750
+ Attach to the local ray cluster if we are running on the head node.
751
+ """
752
+ # This context is set from the outer job
753
+ namespace = None
754
+ # The user has directly called "ray.init(address="anyscale://...")
755
+ # on the head node, so there is no outer job and no context.
756
+ # We can still support this, but we need to pass the runtime env
757
+ # in the job config just like in the ordinary anyscale.connect().
758
+ self._job_config.set_runtime_env(self._user_runtime_env)
759
+
760
+ # RAY_ADDRESS is set to anyscale://
761
+ # We don't want the below ray.init to call into anyscale.connect
762
+ del os.environ["RAY_ADDRESS"]
763
+ return self._ray.init( # This is a ClientContext object
764
+ address="auto", job_config=self._job_config, namespace=namespace
765
+ )
766
+
767
+ def _set_serve_root_url_runtime_env(self, cluster: Session) -> None:
768
+ # Sets SERVE_ROOT_URL_ENV_KEY to be the cluster's Serve URL. This will allow
769
+ # users to pass the URL for Serve deployments with `DeploymentClass.url`
770
+ # TODO(nikita): Update documentation once Ray 1.7 is released
771
+ try:
772
+ from ray.serve.constants import SERVE_ROOT_URL_ENV_KEY
773
+ except ImportError:
774
+ SERVE_ROOT_URL_ENV_KEY = "RAY_SERVE_ROOT_URL"
775
+
776
+ try:
777
+ self._user_runtime_env.setdefault("env_vars", {}).setdefault(
778
+ SERVE_ROOT_URL_ENV_KEY, cluster.user_service_url.rstrip("/")
779
+ )
780
+ except Exception: # noqa: BLE001
781
+ self._log.warning(
782
+ f"Unable to set {SERVE_ROOT_URL_ENV_KEY} in runtime environment. Please specify "
783
+ "full Serve session URL for Serve deployments."
784
+ )
785
+
786
+ def connect(self) -> AnyscaleClientContext:
787
+ """Connect to Anyscale using previously specified options.
788
+
789
+ Examples:
790
+ >>> ray.init("anyscale://cluster_name")
791
+
792
+ WARNING: using a new cluster_compute/cluster_env when connecting to an
793
+ active cluster will not work unless the user passes `update=True`. e.g.:
794
+ >>> ray.init("anyscale://cluster_name?update=True")
795
+ """
796
+
797
+ feature_flag_on = self._api_client.check_is_feature_flag_on_api_v2_userinfo_check_is_feature_flag_on_get(
798
+ "anyscale_connect_enabled_cli"
799
+ ).result.is_on
800
+
801
+ if not feature_flag_on:
802
+ raise RuntimeError(
803
+ "Anyscale Connect is disabled for your organization. Contact support for more details."
804
+ )
805
+ else:
806
+ self._log.warning(
807
+ "DEPRECATION WARNING: Anyscale Connect will be deprecated in future Anyscale versions. "
808
+ "Please use workspaces: "
809
+ "https://docs.anyscale.com/workspaces/get-started or Ray Jobs "
810
+ "https://docs.anyscale.com/workspaces/interactive-development instead."
811
+ )
812
+
813
+ _allow_multiple_clients = (
814
+ os.environ.get("ANYSCALE_ALLOW_MULTIPLE_CLIENTS") != "0"
815
+ )
816
+ self._log.info("Finished parsing arguments.", block_label="ParseArgs")
817
+ self._log.close_block("ParseArgs")
818
+
819
+ self._fill_unset_configs_from_env()
820
+
821
+ if self._ray.util.client.ray.is_connected():
822
+ raise RuntimeError(
823
+ "Already connected to a Ray cluster, please "
824
+ "run anyscale.connect in a new Python process."
825
+ )
826
+
827
+ # Allow the script to be run on an Anyscale cluster node as well.
828
+ if _is_running_on_anyscale_cluster():
829
+ # TODO(mattweber): Make background mode work with default projects.
830
+ # This is a RayClientContext instead of an AnyscaleContext since we are connecting to the local cluster
831
+ return self._bg_connect() # type: ignore
832
+
833
+ if self._run_mode == "local_docker":
834
+ self._exec_self_in_local_docker()
835
+
836
+ self._project_block = create_project_block(
837
+ self._project_dir,
838
+ self._project_name,
839
+ cloud_name=self._cloud_name,
840
+ cluster_compute_name=self._cluster_compute_name,
841
+ cluster_compute_dict=self._cluster_compute_dict,
842
+ )
843
+ project_id = self._project_block.project_id
844
+ project_dir = self._project_block.project_dir
845
+ if project_dir and not self._project_name:
846
+ # Warning when project dir provided or found in current directory and project name not provided
847
+ # as input.
848
+ # TODO(nikita): Remove after .anyscale.yaml is no longer supported
849
+ self._log.warning(
850
+ f"Project directory {project_dir} was detected. Using a project directory "
851
+ "to set the Ray client project and working_dir has been deprecated, and this "
852
+ "functionality will be removed in April 2022. To connect to an Anyscale cluster "
853
+ "in a particular project, please instead specify the project name with "
854
+ f'`ray.init("anyscale://{self._project_block.project_name}/{self._cluster_name if self._cluster_name else ""}")`. '
855
+ "The project name can also be specified by setting the environment variable "
856
+ f'`{PROJECT_NAME_ENV_VAR}="{self._project_block.project_name}"`. '
857
+ "Otherwise the Ray client session will not be grouped to a particular project. "
858
+ "From April 2022, the working_dir must also be specified to upload files and will "
859
+ "not be implied from the project directory.\n"
860
+ )
861
+
862
+ self._prepare_cluster_block = create_prepare_cluster_block(
863
+ project_id=project_id,
864
+ cluster_name=self._cluster_name,
865
+ autosuspend_timeout=self._autosuspend_timeout,
866
+ allow_public_internet_traffic=self._allow_public_internet_traffic,
867
+ needs_update=self._needs_update,
868
+ cluster_compute_name=self._cluster_compute_name,
869
+ cluster_compute_dict=self._cluster_compute_dict,
870
+ cloud_name=self._cloud_name,
871
+ build_pr=self._build_pr,
872
+ force_rebuild=self._force_rebuild,
873
+ build_commit=self._build_commit,
874
+ cluster_env_name=self._cluster_env_name,
875
+ cluster_env_dict=self._cluster_env_dict,
876
+ cluster_env_revision=self._cluster_env_revision,
877
+ ray=self._ray,
878
+ )
879
+ cluster_name = self._prepare_cluster_block.cluster_name
880
+
881
+ cluster = self._get_cluster_or_die(project_id, cluster_name)
882
+ self._set_serve_root_url_runtime_env(cluster)
883
+
884
+ self._set_metadata_in_job_config()
885
+ self._set_runtime_env_in_job_config(project_dir)
886
+
887
+ self._interactive_session_block = start_interactive_session_block(
888
+ cluster=cluster,
889
+ job_config=self._job_config,
890
+ allow_multiple_clients=_allow_multiple_clients,
891
+ initial_scale=self._initial_scale,
892
+ in_shell=self._in_shell,
893
+ run_mode=self._run_mode,
894
+ ray_init_kwargs=self._ray_init_kwargs,
895
+ secure=self._secure,
896
+ ignore_version_check=self._ignore_version_check,
897
+ ray=self._ray,
898
+ subprocess=self._subprocess,
899
+ )
900
+
901
+ return self._interactive_session_block.anyscale_client_context
902
+
903
+ def cloud(self, cloud_name: str) -> "ClientBuilder":
904
+ """Set the name of the cloud to be used.
905
+
906
+ This sets the name of the cloud that your connect cluster will be started
907
+ in by default. This is completely ignored if you pass in a cluster compute config.
908
+
909
+ Args:
910
+ cloud_name (str): Name of the cloud to start the cluster in.
911
+
912
+ Examples:
913
+ >>> ray.init("anyscale://cluster_name", cloud="aws_test_account")
914
+ """
915
+ self._cloud_name = cloud_name
916
+ return self
917
+
918
+ def project_dir(
919
+ self, local_dir: str, name: Optional[str] = None
920
+ ) -> "ClientBuilder":
921
+ """DEPRECATED. project_dir should not be set by an argument,
922
+ but it's okay for it to be set within this class for other reasons.
923
+
924
+ Set the project directory path on the user's laptop.
925
+
926
+ This sets the project code directory. If not specified, the project
927
+ directory will be autodetected based on the current working directory.
928
+ If no Anyscale project is found, the organization's default project will be used.
929
+ In general the project directory will be synced to all nodes in the
930
+ cluster as required by Ray, except for when the user passes
931
+ "working_dir" in `.env()` in which case we sync the latter instead.
932
+
933
+ Args:
934
+ local_dir (str): path to the project directory.
935
+ name (str): optional name to use if the project doesn't exist.
936
+
937
+ Examples:
938
+ >>> ray.init("anyscale://cluster_name", project_dir="~/my-proj-dir")
939
+ """
940
+ self._project_dir = os.path.abspath(os.path.expanduser(local_dir))
941
+ self._project_name = name
942
+ return self
943
+
944
+ def session(self, cluster_name: str, update: bool = False) -> "ClientBuilder":
945
+ """Set a fixed cluster name.
946
+
947
+ Setting a fixed cluster name will create a new cluster if a cluster
948
+ with cluster_name does not exist. Otherwise it will reconnect to an existing
949
+ cluster.
950
+
951
+ Args:
952
+ cluster_name (str): fixed name of the cluster.
953
+ update (bool): whether to update cluster configurations when
954
+ connecting to an existing cluster. Note that this may restart
955
+ the Ray runtime. By default update is set to False.
956
+
957
+ Examples:
958
+ >>> anyscale.session("prod_deployment", update=True).connect()
959
+ """
960
+ slugified_name = slugify(cluster_name)
961
+ if slugified_name != cluster_name:
962
+ self._log.error(
963
+ f"Using `{slugified_name}` as the cluster name (instead of `{cluster_name}`)"
964
+ )
965
+
966
+ self._needs_update = update
967
+ self._cluster_name = slugified_name
968
+
969
+ return self
970
+
971
+ def run_mode(self, run_mode: Optional[str] = None) -> "ClientBuilder":
972
+ """Re-exec the driver program in the remote cluster or local docker.
973
+
974
+ By setting ``run_mode("local_docker")``, you can tell Anyscale
975
+ to re-exec the program driver in a local docker image, ensuring the
976
+ driver environment will exactly match that of the remote cluster.
977
+
978
+ You can also change the run mode by setting the ANYSCALE_LOCAL_DOCKER=1
979
+ environment variable. Changing the run mode
980
+ is only supported for script execution. Attempting to change the run
981
+ mode in a notebook or Python shell will raise an error.
982
+
983
+ Args:
984
+ run_mode (str): either None, or "local_docker".
985
+
986
+ Examples:
987
+ >>> ray.init("anyscale://cluster_name")
988
+ """
989
+ if run_mode not in [None, "local_docker"]:
990
+ raise ValueError(f"Unknown run mode {run_mode}")
991
+ if self._in_shell and run_mode == "local_docker":
992
+ raise ValueError("Local docker mode is not supported in Python shells.")
993
+ self._run_mode = run_mode
994
+ return self
995
+
996
+ def base_docker_image(self, image_name: str) -> None: # noqa: ARG002
997
+ """[DEPRECATED] Set the docker image to use for the cluster.
998
+ IMPORTANT: the Python minor version of the manually specified docker
999
+ image must match the local Python version.
1000
+ Args:
1001
+ image_name (str): docker image name.
1002
+ Examples:
1003
+ >>> anyscale.base_docker_image("anyscale/ray-ml:latest").connect()
1004
+ """
1005
+ raise ValueError(
1006
+ "Anyscale connect doesn't support starting clusters with base docker images. "
1007
+ "Please specify a cluster_env instead. For example: "
1008
+ '`ray.init("anyscale://cluster_name?cluster_env=name:1")`'
1009
+ )
1010
+
1011
+ def require(self, requirements: Union[str, List[str]]) -> None: # noqa: ARG002
1012
+ """[DEPRECATED] Set the Python requirements for the cluster.
1013
+ Args:
1014
+ requirements: either be a list of pip library specifications, or
1015
+ the path to a requirements.txt file.
1016
+ Examples:
1017
+ >>> anyscale.require("~/proj/requirements.txt").connect()
1018
+ >>> anyscale.require(["gym", "torch>=1.4.0"]).connect()
1019
+ """
1020
+ raise ValueError(
1021
+ "Anyscale connect no longer accepts the `.require()` argument."
1022
+ "Please specify these requirements in your runtime env instead."
1023
+ 'For example `ray.init("anyscale://my_cluster", runtime_env({"pip":["chess"'
1024
+ ',"xgboost"]})`.'
1025
+ )
1026
+
1027
+ def cluster_compute(
1028
+ self, cluster_compute: Union[str, CLUSTER_COMPUTE_DICT_TYPE]
1029
+ ) -> "ClientBuilder":
1030
+ """Set the Anyscale cluster compute to use for the cluster.
1031
+
1032
+ Args:
1033
+ cluster_compute: Name of the cluster compute
1034
+ or a dictionary to build a new cluster compute.
1035
+ For example "my-cluster-compute".
1036
+
1037
+
1038
+ Examples:
1039
+ >>> ray.init("anyscale://cluster_name?cluster_compute=my_cluster_compute")
1040
+ >>> ray.init("anyscale://cluster_name", cluster_compute="my_cluster_compute")
1041
+ >>> ray.init("anyscale://cluster_name", cluster_compute={"cloud_id": "1234", ... })
1042
+
1043
+ WARNING:
1044
+ If you want to pass a dictionary cluster_compute please pass it using
1045
+ the `cluster_compute` argument. Passing it in the URL format will not work.
1046
+ """
1047
+ if isinstance(cluster_compute, str):
1048
+ self._cluster_compute_name = cluster_compute # type: ignore
1049
+ elif isinstance(cluster_compute, dict):
1050
+ self._cluster_compute_dict = copy.deepcopy(cluster_compute) # type: ignore
1051
+ else:
1052
+ raise TypeError(
1053
+ "cluster_compute should either be Dict[str, Any] or a string."
1054
+ )
1055
+ return self
1056
+
1057
+ def cluster_env(
1058
+ self, cluster_env: Union[str, CLUSTER_ENV_DICT_TYPE]
1059
+ ) -> "ClientBuilder":
1060
+ """TODO(ameer): remove app_config below after a few releases.
1061
+ Set the Anyscale cluster environment to use for the cluster.
1062
+
1063
+ IMPORTANT: the Python minor version of the manually specified cluster
1064
+ environment must match the local Python version, and the Ray version must
1065
+ also be compatible with the one on the client. for example, if your local
1066
+ laptop environment is using ray 1.4 and python 3.8, then the cluster environment
1067
+ ray version must be 1.4 and python version must be 3.8.
1068
+
1069
+ Args:
1070
+ cluster_env: Name (and optionally revision) of
1071
+ the cluster environment or a dictionary to build a new cluster environment.
1072
+ For example "my_cluster_env:2" where the revision would be 2.
1073
+ If no revision is specified, use the latest revision.
1074
+ NOTE: if you pass a dictionary it will always rebuild a new cluster environment
1075
+ before starting the cluster.
1076
+
1077
+ Examples:
1078
+ >>> ray.init("anyscale://cluster_name?cluster_env=prev_created_cluster_env:2")
1079
+ >>> ray.init("anyscale://cluster_name", cluster_env="prev_created_cluster_env:2")
1080
+ >>> ray.init("anyscale://cluster_name", cluster_env={"base_image": "anyscale/ray-ml:1.1.0-gpu"})
1081
+
1082
+ WARNING:
1083
+ If you want to pass a dictionary cluster environment please pass it using
1084
+ the `cluster_env` argument. Passing it in the URL format will not work.
1085
+ """
1086
+ self.app_config(cluster_env)
1087
+ return self
1088
+
1089
+ def app_config(
1090
+ self, cluster_env: Union[str, CLUSTER_ENV_DICT_TYPE],
1091
+ ) -> "ClientBuilder":
1092
+ """Set the Anyscale app config to use for the session.
1093
+
1094
+ IMPORTANT: the Python minor version of the manually specified app
1095
+ config must match the local Python version, and the Ray version must
1096
+ also be compatible with the one on the client.
1097
+
1098
+ Args:
1099
+ cluster_env: Name (and optionally revision) of
1100
+ the cluster environment or a dictionary to build a new cluster environment.
1101
+ For example "my_cluster_env:2" where the revision would be 2.
1102
+ If no revision is specified, use the latest revision.
1103
+
1104
+ Examples:
1105
+ >>> anyscale.app_config("prev_created_config:2").connect()
1106
+ """
1107
+
1108
+ if self._build_commit or self._build_pr:
1109
+ raise ValueError("app_config() conflicts with build_from_source()")
1110
+ if isinstance(cluster_env, str):
1111
+ components = cluster_env.rsplit(":", 1) # type: ignore
1112
+ self._cluster_env_name = components[0]
1113
+ if len(components) == 1:
1114
+ self._cluster_env_revision = None
1115
+ else:
1116
+ self._cluster_env_revision = int(components[1])
1117
+ elif isinstance(cluster_env, dict):
1118
+ cluster_env_copy: CLUSTER_ENV_DICT_TYPE = copy.deepcopy(cluster_env) # type: ignore
1119
+ self._cluster_env_name = cluster_env_copy.pop("name", None) # type: ignore
1120
+ self._cluster_env_dict = cluster_env_copy
1121
+ else:
1122
+ raise TypeError("The type of cluster_env must be either a str or a dict.")
1123
+ return self
1124
+
1125
+ def download_results(
1126
+ self, *, remote_dir: str, local_dir: str # NOQA: ARG002
1127
+ ) -> None:
1128
+ """Specify a directory to sync down from the cluster head node.
1129
+
1130
+ IMPORTANT: the data is downloaded immediately after this call.
1131
+ `download_results` must not be called with `.connect()`. See examples below.
1132
+
1133
+ Args:
1134
+ remote_dir (str): the result dir on the head node.
1135
+ local_dir (str): the local path to download the results to.
1136
+
1137
+ Examples:
1138
+ >>> ray.client("anyscale://cluster_name")
1139
+ ... .download_results(
1140
+ ... local_dir="~/ray_results", remote_dir="/home/ray/proj_output")
1141
+ >>> ray.client("anyscale://").download_results(
1142
+ ... local_dir="~/ray_results", remote_dir="/home/ray/proj_output")
1143
+ >>> anyscale.download_results(
1144
+ ... local_dir="~/ray_results", remote_dir="/home/ray/proj_output")
1145
+ """
1146
+ if not self._ray.util.client.ray.is_connected():
1147
+ raise RuntimeError(
1148
+ "Not connected to cluster. Please re-run this after "
1149
+ 'to a cluster via ray.client("anyscale://...").connect()'
1150
+ )
1151
+
1152
+ raise RuntimeError("Downloading results is not supported on anyscale V2")
1153
+
1154
+ def autosuspend(
1155
+ self,
1156
+ enabled: bool = True,
1157
+ *,
1158
+ hours: Optional[int] = None,
1159
+ minutes: Optional[int] = None,
1160
+ ) -> "ClientBuilder":
1161
+ """Configure or disable cluster autosuspend behavior.
1162
+
1163
+ The cluster will be autosuspend after the specified time period. By
1164
+ default, cluster auto terminate after one hour of idle.
1165
+
1166
+ Args:
1167
+ enabled (bool): whether autosuspend is enabled.
1168
+ hours (int): specify idle time in hours.
1169
+ minutes (int): specify idle time in minutes. This is added to the
1170
+ idle time in hours.
1171
+
1172
+ Examples:
1173
+ >>> ray.init("anyscale://cluster_name", autosuspend=-1) # to disable
1174
+ >>> ray.init("anyscale://cluster_name", autosuspend="2h")
1175
+ """
1176
+ if enabled:
1177
+ if hours is None and minutes is None:
1178
+ timeout = None
1179
+ else:
1180
+ timeout = 0
1181
+ if hours is not None:
1182
+ timeout += hours * 60
1183
+ if minutes is not None:
1184
+ timeout += minutes
1185
+ else:
1186
+ timeout = -1
1187
+ self._autosuspend_timeout = timeout
1188
+ return self
1189
+
1190
+ def allow_public_internet_traffic(self, enabled: bool = False) -> "ClientBuilder":
1191
+ """Enable or disable public internet trafic for Serve deployments.
1192
+
1193
+ Disabling public internet traffic causes the Serve deployments running on this cluster
1194
+ to be put behind an authentication proxy. By default, clusters will be started with
1195
+ Serve deployments rejecting internet traffic unless an authentication token is included
1196
+ in the cookies.
1197
+
1198
+ Args:
1199
+ enabled (bool): whether public internet traffic is accepted for Serve deployments
1200
+
1201
+ Examples:
1202
+ >>> ray.init("anyscale://cluster_name", allow_public_internet_traffic=True)
1203
+ """
1204
+ self._allow_public_internet_traffic = enabled
1205
+ return self
1206
+
1207
+ def build_from_source(
1208
+ self,
1209
+ *,
1210
+ git_commit: Optional[str] = None,
1211
+ github_pr_id: Optional[int] = None,
1212
+ force_rebuild: bool = False,
1213
+ ) -> "ClientBuilder":
1214
+ """Build Ray from source for the cluster runtime.
1215
+
1216
+ This is an experimental feature.
1217
+
1218
+ Note that the first build for a new base image might take upwards of
1219
+ half an hour. Subsequent builds will have cached compilation stages.
1220
+
1221
+ Args:
1222
+ git_commit (Optional[str]): If specified, try to checkout the exact
1223
+ git commit from the Ray master branch. If pull_request_id is
1224
+ also specified, the commit may be from the PR branch as well.
1225
+ github_pr_id (Optional[int]): Specify the pull request id to use.
1226
+ If no git commit is specified, the latest commit from the pr
1227
+ will be used.
1228
+ force_rebuild (bool): Force rebuild of the app config.
1229
+
1230
+ Examples:
1231
+ >>> anyscale
1232
+ ... .build_from_source(git_commit="f1e293c", github_pr_id=12345)
1233
+ ... .connect()
1234
+ """
1235
+ if self._cluster_env_name:
1236
+ raise ValueError("cluster_env() conflicts with build_from_source()")
1237
+ self._build_commit = git_commit
1238
+ self._build_pr = github_pr_id
1239
+ self._force_rebuild = force_rebuild
1240
+ return self
1241
+
1242
+ def request_resources(
1243
+ self,
1244
+ *,
1245
+ num_cpus: Optional[int] = None,
1246
+ num_gpus: Optional[int] = None,
1247
+ bundles: Optional[List[Dict[str, float]]] = None,
1248
+ ) -> "ClientBuilder":
1249
+ """Configure the initial resources to scale to.
1250
+
1251
+ The cluster will immediately attempt to scale to accomodate the
1252
+ requested resources, bypassing normal upscaling speed constraints.
1253
+ The requested resources are pinned and exempt from downscaling.
1254
+
1255
+ Args:
1256
+ num_cpus (int): number of cpus to request.
1257
+ num_gpus (int): number of gpus to request.
1258
+ bundles (List[Dict[str, float]): resource bundles to
1259
+ request. Each bundle is a dict of resource_name to quantity
1260
+ that can be allocated on a single machine. Note that the
1261
+ ``num_cpus`` and ``num_gpus`` args simply desugar into
1262
+ ``[{"CPU": 1}] * num_cpus`` and ``[{"GPU": 1}] * num_gpus``
1263
+ respectively.
1264
+
1265
+ Examples:
1266
+ >>> ray.init("anyscale://cluster_name", request_cpus=200, request_gpus=30)
1267
+ >>> ray.init("anyscale://cluster_name", request_cpus=8,
1268
+ ... request_bundles=[{"GPU": 8}, {"GPU": 8}, {"GPU": 1}],
1269
+ ... )
1270
+ """
1271
+ to_request: List[Dict[str, float]] = []
1272
+ if num_cpus:
1273
+ to_request += [{"CPU": 1}] * num_cpus
1274
+ if num_gpus:
1275
+ to_request += [{"GPU": 1}] * num_gpus
1276
+ if bundles:
1277
+ to_request += bundles
1278
+ self._initial_scale = to_request
1279
+ return self
1280
+
1281
+ def _get_cluster_or_die(self, project_id: str, session_name: str) -> Session:
1282
+ """Query Anyscale for the given cluster's metadata."""
1283
+ cluster_found = get_cluster(self._anyscale_sdk, project_id, session_name)
1284
+ if not cluster_found:
1285
+ raise RuntimeError(f"Failed to locate cluster: {session_name}")
1286
+ return cluster_found
1287
+
1288
+ def _exec_self_in_local_docker(self) -> None:
1289
+ """Run the current main file in a local docker image."""
1290
+ cur_file = os.path.abspath(sys.argv[0])
1291
+ docker_image = _get_base_image("ray-ml", MINIMUM_RAY_VERSION, "cpu")
1292
+ command = [
1293
+ "docker",
1294
+ "run",
1295
+ "--env",
1296
+ "ANYSCALE_HOST={}".format(
1297
+ anyscale.shared_anyscale_utils.conf.ANYSCALE_HOST
1298
+ ),
1299
+ "--env",
1300
+ f"ANYSCALE_CLI_TOKEN={self._credentials}",
1301
+ "-v",
1302
+ f"{cur_file}:/user_main.py",
1303
+ "--entrypoint=/bin/bash",
1304
+ docker_image,
1305
+ "-c",
1306
+ "python /user_main.py {}".format(
1307
+ " ".join([shlex.quote(x) for x in sys.argv[1:]])
1308
+ ),
1309
+ ]
1310
+ self._log.debug("Running", command)
1311
+ self._subprocess.check_call(command)
1312
+ self._os._exit(0) # pylint:disable=private-use # noqa: SLF001
1313
+
1314
+
1315
+ # This implements the following utility function for users:
1316
+ # $ pip install -U `python -m anyscale.connect required_ray_version`
1317
+ if __name__ == "__main__":
1318
+ if len(sys.argv) > 1 and sys.argv[1] == "required_ray_version":
1319
+ # TODO(ilr/nikita) Make this >= MINIMUM VERSION when we derive MINIMUM VERSION
1320
+ # from the backend.
1321
+ print(f"ray=={MINIMUM_RAY_VERSION}")
1322
+ else:
1323
+ raise ValueError("Unsupported argument.")