@@ -87,7 +87,7 @@ def list_runtimes(self) -> list[types.Runtime]:
8787 f"{ constants .RUNTIME_FRAMEWORK_LABEL } label."
8888 )
8989 continue
90- result .append (self .__get_runtime_from_crd (runtime ))
90+ result .append (self .__get_runtime_from_cr (runtime ))
9191
9292 except multiprocessing .TimeoutError as e :
9393 raise TimeoutError (
@@ -129,7 +129,7 @@ def get_runtime(self, name: str) -> types.Runtime:
129129 f"{ self .namespace } /{ name } "
130130 ) from e
131131
132- return self .__get_runtime_from_crd (runtime ) # type: ignore
132+ return self .__get_runtime_from_cr (runtime ) # type: ignore
133133
134134 def get_runtime_packages (self , runtime : types .Runtime ):
135135 if runtime .trainer .trainer_type == types .TrainerType .BUILTIN_TRAINER :
@@ -249,7 +249,7 @@ def list_jobs(self, runtime: Optional[types.Runtime] = None) -> list[types.Train
249249 ):
250250 continue
251251
252- result .append (self .__get_trainjob_from_crd (trainjob ))
252+ result .append (self .__get_trainjob_from_cr (trainjob ))
253253
254254 except multiprocessing .TimeoutError as e :
255255 raise TimeoutError (
@@ -288,7 +288,7 @@ def get_job(self, name: str) -> types.TrainJob:
288288 f"Failed to get { constants .TRAINJOB_KIND } : { self .namespace } /{ name } "
289289 ) from e
290290
291- return self .__get_trainjob_from_crd (trainjob ) # type: ignore
291+ return self .__get_trainjob_from_cr (trainjob ) # type: ignore
292292
293293 def get_job_logs (
294294 self ,
@@ -395,66 +395,66 @@ def delete_job(self, name: str):
395395
396396 logger .debug (f"{ constants .TRAINJOB_KIND } { self .namespace } /{ name } has been deleted" )
397397
398- def __get_runtime_from_crd (
398+ def __get_runtime_from_cr (
399399 self ,
400- runtime_crd : models .TrainerV1alpha1ClusterTrainingRuntime ,
400+ runtime_cr : models .TrainerV1alpha1ClusterTrainingRuntime ,
401401 ) -> types .Runtime :
402402 if not (
403- runtime_crd .metadata
404- and runtime_crd .metadata .name
405- and runtime_crd .spec
406- and runtime_crd .spec .ml_policy
407- and runtime_crd .spec .template .spec
408- and runtime_crd .spec .template .spec .replicated_jobs
403+ runtime_cr .metadata
404+ and runtime_cr .metadata .name
405+ and runtime_cr .spec
406+ and runtime_cr .spec .ml_policy
407+ and runtime_cr .spec .template .spec
408+ and runtime_cr .spec .template .spec .replicated_jobs
409409 ):
410- raise Exception (f"ClusterTrainingRuntime CRD is invalid: { runtime_crd } " )
410+ raise Exception (f"ClusterTrainingRuntime CR is invalid: { runtime_cr } " )
411411
412412 if not (
413- runtime_crd .metadata .labels
414- and constants .RUNTIME_FRAMEWORK_LABEL in runtime_crd .metadata .labels
413+ runtime_cr .metadata .labels
414+ and constants .RUNTIME_FRAMEWORK_LABEL in runtime_cr .metadata .labels
415415 ):
416416 raise Exception (
417- f"Runtime { runtime_crd .metadata .name } must have "
417+ f"Runtime { runtime_cr .metadata .name } must have "
418418 f"{ constants .RUNTIME_FRAMEWORK_LABEL } label"
419419 )
420420
421421 return types .Runtime (
422- name = runtime_crd .metadata .name ,
422+ name = runtime_cr .metadata .name ,
423423 trainer = utils .get_runtime_trainer (
424- runtime_crd .metadata .labels [constants .RUNTIME_FRAMEWORK_LABEL ],
425- runtime_crd .spec .template .spec .replicated_jobs ,
426- runtime_crd .spec .ml_policy ,
424+ runtime_cr .metadata .labels [constants .RUNTIME_FRAMEWORK_LABEL ],
425+ runtime_cr .spec .template .spec .replicated_jobs ,
426+ runtime_cr .spec .ml_policy ,
427427 ),
428428 )
429429
430- def __get_trainjob_from_crd (
430+ def __get_trainjob_from_cr (
431431 self ,
432- trainjob_crd : models .TrainerV1alpha1TrainJob ,
432+ trainjob_cr : models .TrainerV1alpha1TrainJob ,
433433 ) -> types .TrainJob :
434434 if not (
435- trainjob_crd .metadata
436- and trainjob_crd .metadata .name
437- and trainjob_crd .metadata .namespace
438- and trainjob_crd .spec
439- and trainjob_crd .metadata .creation_timestamp
435+ trainjob_cr .metadata
436+ and trainjob_cr .metadata .name
437+ and trainjob_cr .metadata .namespace
438+ and trainjob_cr .spec
439+ and trainjob_cr .metadata .creation_timestamp
440440 ):
441- raise Exception (f"TrainJob CRD is invalid: { trainjob_crd } " )
441+ raise Exception (f"TrainJob CR is invalid: { trainjob_cr } " )
442442
443- name = trainjob_crd .metadata .name
444- namespace = trainjob_crd .metadata .namespace
443+ name = trainjob_cr .metadata .name
444+ namespace = trainjob_cr .metadata .namespace
445445
446- runtime = self .get_runtime (trainjob_crd .spec .runtime_ref .name )
446+ runtime = self .get_runtime (trainjob_cr .spec .runtime_ref .name )
447447
448- # Construct the TrainJob from the CRD .
448+ # Construct the TrainJob from the CR .
449449 trainjob = types .TrainJob (
450450 name = name ,
451- creation_timestamp = trainjob_crd .metadata .creation_timestamp ,
451+ creation_timestamp = trainjob_cr .metadata .creation_timestamp ,
452452 runtime = runtime ,
453453 steps = [],
454454 # Number of nodes is taken from TrainJob or TrainingRuntime
455455 num_nodes = (
456- trainjob_crd .spec .trainer .num_nodes
457- if trainjob_crd .spec .trainer and trainjob_crd .spec .trainer .num_nodes
456+ trainjob_cr .spec .trainer .num_nodes
457+ if trainjob_cr .spec .trainer and trainjob_cr .spec .trainer .num_nodes
458458 else runtime .trainer .num_nodes
459459 ),
460460 status = constants .TRAINJOB_CREATED , # The default TrainJob status.
@@ -516,8 +516,8 @@ def __get_trainjob_from_crd(
516516 ) from e
517517
518518 # Update the TrainJob status from its conditions.
519- if trainjob_crd .status and trainjob_crd .status .conditions :
520- for c in trainjob_crd .status .conditions :
519+ if trainjob_cr .status and trainjob_cr .status .conditions :
520+ for c in trainjob_cr .status .conditions :
521521 if (
522522 c .type == constants .TRAINJOB_COMPLETE
523523 and c .status == "True"
@@ -554,20 +554,20 @@ def _get_trainjob_spec(
554554 runtime = self .get_runtime (constants .TORCH_RUNTIME )
555555
556556 # Build the Trainer.
557- trainer_crd = models .TrainerV1alpha1Trainer ()
557+ trainer_cr = models .TrainerV1alpha1Trainer ()
558558
559559 if trainer :
560560 # If users choose to use a custom training function.
561561 if isinstance (trainer , types .CustomTrainer ):
562562 if runtime .trainer .trainer_type != types .TrainerType .CUSTOM_TRAINER :
563563 raise ValueError (f"CustomTrainer can't be used with { runtime } runtime" )
564- trainer_crd = utils .get_trainer_crd_from_custom_trainer (runtime , trainer )
564+ trainer_cr = utils .get_trainer_cr_from_custom_trainer (runtime , trainer )
565565
566566 # If users choose to use a builtin trainer for post-training.
567567 elif isinstance (trainer , types .BuiltinTrainer ):
568568 if runtime .trainer .trainer_type != types .TrainerType .BUILTIN_TRAINER :
569569 raise ValueError (f"BuiltinTrainer can't be used with { runtime } runtime" )
570- trainer_crd = utils .get_trainer_crd_from_builtin_trainer (
570+ trainer_cr = utils .get_trainer_cr_from_builtin_trainer (
571571 runtime , trainer , initializer
572572 )
573573
@@ -579,7 +579,7 @@ def _get_trainjob_spec(
579579
580580 return models .TrainerV1alpha1TrainJobSpec (
581581 runtimeRef = models .TrainerV1alpha1RuntimeRef (name = runtime .name ),
582- trainer = (trainer_crd if trainer_crd != models .TrainerV1alpha1Trainer () else None ),
582+ trainer = (trainer_cr if trainer_cr != models .TrainerV1alpha1Trainer () else None ),
583583 initializer = (
584584 models .TrainerV1alpha1Initializer (
585585 dataset = utils .get_dataset_initializer (initializer .dataset ),
0 commit comments