Example #1
0
def get_job_cluster(j: Job) -> Optional[Cluster]:
  '''gets the cluster name from a Job object'''
  if j.spec.platform != Platform.GKE:
    return None

  return Cluster.get(name=j.details['cluster_name'],
                     project_id=j.details['project_id'],
                     zone=j.details['cluster_zone'],
                     creds=default_credentials().credentials)
Example #2
0
    def wrapper(args: dict,
                project_id: str,
                creds: Credentials,
                zone: str = k.ZONE_DEFAULT):
        cluster_name = args.get('cluster_name')

        cluster = Cluster.get(name=cluster_name,
                              project_id=project_id,
                              zone=zone,
                              creds=creds)

        return fn(args, cluster=cluster) if cluster else None