@@ -913,6 +913,66 @@ def operate_pod(
913913 return TimeUtil .from_datetime (current_time_utc )
914914
915915
916+ @task
917+ def suspended_jobset (node_pool : node_pool_info , jobset_config : JobSet ):
918+ """
919+ Suspend a jobset from the GKE cluster.
920+
921+ This task executes a bash script to:
922+ 1. Authenticate `gcloud` with the specified GKE cluster.
923+ 2. Suspend a JobSet.
924+
925+ Args:
926+ node_pool: Configuration object with cluster details.
927+ jobset_name: The name of the JobSet to delete.
928+ """
929+
930+ with tempfile .NamedTemporaryFile () as temp_config_file :
931+ env = os .environ .copy ()
932+ env ["KUBECONFIG" ] = temp_config_file .name
933+
934+ cmd = " && " .join ([
935+ Command .get_credentials_command (node_pool ),
936+ Command .k8s_suspend_jobset_command (
937+ temp_config_file .name ,
938+ jobset_config .jobset_name ,
939+ jobset_config .namespace ,
940+ ),
941+ ])
942+
943+ subprocess .run_exec (cmd , env = env )
944+
945+
946+ @task
947+ def resume_jobset (node_pool : node_pool_info , jobset_config : JobSet ):
948+ """
949+ Resume a jobset from the GKE cluster.
950+
951+ This task executes a bash script to:
952+ 1. Authenticate `gcloud` with the specified GKE cluster.
953+ 2. Resume a JobSet.
954+
955+ Args:
956+ node_pool: Configuration object with cluster details.
957+ jobset_name: The name of the JobSet to delete.
958+ """
959+
960+ with tempfile .NamedTemporaryFile () as temp_config_file :
961+ env = os .environ .copy ()
962+ env ["KUBECONFIG" ] = temp_config_file .name
963+
964+ cmd = " && " .join ([
965+ Command .get_credentials_command (node_pool ),
966+ Command .k8s_resume_jobset_command (
967+ temp_config_file .name ,
968+ jobset_config .jobset_name ,
969+ jobset_config .namespace ,
970+ ),
971+ ])
972+
973+ subprocess .run_exec (cmd , env = env )
974+
975+
916976@task .sensor (poke_interval = 30 , timeout = 900 , mode = "poke" )
917977def wait_for_jobset_started (
918978 node_pool : node_pool_info ,
0 commit comments