@@ -836,6 +836,66 @@ def operate_pod(
836836 return pod_name
837837
838838
839+ @task
840+ def suspended_jobset (node_pool : node_pool_info , jobset_config : JobSet ):
841+ """
842+ Suspend a jobset from the GKE cluster.
843+
844+ This task executes a bash script to:
845+ 1. Authenticate `gcloud` with the specified GKE cluster.
846+ 2. Suspend a JobSet.
847+
848+ Args:
849+ node_pool: Configuration object with cluster details.
850+ jobset_name: The name of the JobSet to delete.
851+ """
852+
853+ with tempfile .NamedTemporaryFile () as temp_config_file :
854+ env = os .environ .copy ()
855+ env ["KUBECONFIG" ] = temp_config_file .name
856+
857+ cmd = " && " .join ([
858+ Command .get_credentials_command (node_pool ),
859+ Command .k8s_suspend_jobset_command (
860+ temp_config_file .name ,
861+ jobset_config .jobset_name ,
862+ jobset_config .namespace ,
863+ ),
864+ ])
865+
866+ subprocess .run_exec (cmd , env = env )
867+
868+
869+ @task
870+ def resume_jobset (node_pool : node_pool_info , jobset_config : JobSet ):
871+ """
872+ Resume a jobset from the GKE cluster.
873+
874+ This task executes a bash script to:
875+ 1. Authenticate `gcloud` with the specified GKE cluster.
876+ 2. Resume a JobSet.
877+
878+ Args:
879+ node_pool: Configuration object with cluster details.
880+ jobset_name: The name of the JobSet to delete.
881+ """
882+
883+ with tempfile .NamedTemporaryFile () as temp_config_file :
884+ env = os .environ .copy ()
885+ env ["KUBECONFIG" ] = temp_config_file .name
886+
887+ cmd = " && " .join ([
888+ Command .get_credentials_command (node_pool ),
889+ Command .k8s_resume_jobset_command (
890+ temp_config_file .name ,
891+ jobset_config .jobset_name ,
892+ jobset_config .namespace ,
893+ ),
894+ ])
895+
896+ subprocess .run_exec (cmd , env = env )
897+
898+
839899@task .sensor (poke_interval = 30 , timeout = 900 , mode = "poke" )
840900def wait_for_jobset_started (
841901 node_pool : node_pool_info ,
0 commit comments