def get_config_map(namespace, project_name, experiment_group_name, experiment_name, project_uuid, experiment_group_uuid, experiment_uuid, original_name, cloning_strategy, cluster_def, declarations, log_level): name = constants.CONFIG_MAP_NAME.format(experiment_uuid=experiment_uuid) labels = get_map_labels(project_name, experiment_group_name, experiment_name, project_uuid, experiment_group_uuid, experiment_uuid) metadata = client.V1ObjectMeta(name=name, labels=labels, namespace=namespace) experiment_outputs_path = get_experiment_outputs_path( experiment_name=experiment_name, original_name=original_name, cloning_strategy=cloning_strategy) experiment_logs_path = get_experiment_logs_path(experiment_name) experiment_data_path = get_project_data_path(project_name) data = { constants.CONFIG_MAP_CLUSTER_KEY_NAME: json.dumps(cluster_def), constants.CONFIG_MAP_DECLARATIONS_KEY_NAME: json.dumps(declarations) or '{}', constants.CONFIG_MAP_EXPERIMENT_INFO_KEY_NAME: json.dumps(labels), constants.CONFIG_MAP_LOG_LEVEL_KEY_NAME: log_level, API_KEY_NAME: get_settings_api_url(), constants.CONFIG_MAP_EXPERIMENT_OUTPUTS_PATH_KEY_NAME: experiment_outputs_path, constants.CONFIG_MAP_EXPERIMENT_LOGS_PATH_KEY_NAME: experiment_logs_path, constants.CONFIG_MAP_EXPERIMENT_DATA_PATH_KEY_NAME: experiment_data_path, } return client.V1ConfigMap(api_version=k8s_constants.K8S_API_VERSION_V1, kind=k8s_constants.K8S_CONFIG_MAP_KIND, metadata=metadata, data=data)
def get_service_env_vars(namespace='default'): return [ get_env_var(name='POLYAXON_K8S_NAMESPACE', value=namespace), get_from_app_secret('POLYAXON_SECRET_KEY', 'polyaxon-secret'), get_from_app_secret('POLYAXON_INTERNAL_SECRET_TOKEN', 'polyaxon-internal-secret-token'), get_from_app_secret('POLYAXON_RABBITMQ_PASSWORD', 'rabbitmq-password', settings.POLYAXON_K8S_RABBITMQ_SECRET_NAME), get_env_var(name=API_KEY_NAME, value=get_settings_api_url()), ]
def get_job_env_vars(log_level, outputs_path, logs_path, data_path, project_data_path=None): return [ get_env_var(name=constants.CONFIG_MAP_LOG_LEVEL_KEY_NAME, value=log_level), get_env_var(name=API_KEY_NAME, value=get_settings_api_url()), get_env_var(name=constants.CONFIG_MAP_RUN_OUTPUTS_PATH_KEY_NAME, value=outputs_path), get_env_var(name=constants.CONFIG_MAP_RUN_LOGS_PATH_KEY_NAME, value=logs_path), get_env_var(name=constants.CONFIG_MAP_RUN_DATA_PATH_KEY_NAME, value=data_path), get_env_var(name=constants.CONFIG_MAP_PROJECT_DATA_PATH_KEY_NAME, value=project_data_path), get_from_app_secret('POLYAXON_INTERNAL_SECRET_TOKEN', 'polyaxon-internal-secret-token'), ]
def get_config_map(namespace, project_name, experiment_group_name, experiment_name, project_uuid, experiment_group_uuid, experiment_uuid, original_name, cloning_strategy, cluster_def, declarations, log_level): name = constants.CONFIG_MAP_NAME.format(uuid=experiment_uuid) labels = get_map_labels(project_name, experiment_group_name, experiment_name, project_uuid, experiment_group_uuid, experiment_uuid) metadata = client.V1ObjectMeta(name=name, labels=labels, namespace=namespace) experiment_outputs_path = get_experiment_outputs_path(experiment_name=experiment_name, original_name=original_name, cloning_strategy=cloning_strategy) experiment_logs_path = get_experiment_logs_path(experiment_name) experiment_data_path = get_project_data_path(project_name) data = { constants.CONFIG_MAP_CLUSTER_KEY_NAME: json.dumps(cluster_def), constants.CONFIG_MAP_DECLARATIONS_KEY_NAME: json.dumps(declarations) or '{}', constants.CONFIG_MAP_EXPERIMENT_INFO_KEY_NAME: json.dumps(labels), constants.CONFIG_MAP_LOG_LEVEL_KEY_NAME: log_level, API_KEY_NAME: get_settings_api_url(), constants.CONFIG_MAP_RUN_OUTPUTS_PATH_KEY_NAME: experiment_outputs_path, constants.CONFIG_MAP_RUN_LOGS_PATH_KEY_NAME: experiment_logs_path, constants.CONFIG_MAP_RUN_DATA_PATH_KEY_NAME: experiment_data_path, } return client.V1ConfigMap(api_version=k8s_constants.K8S_API_VERSION_V1, kind=k8s_constants.K8S_CONFIG_MAP_KIND, metadata=metadata, data=data)
def get_job_env_vars(outputs_path, data_paths, log_level=None, logs_path=None, outputs_refs_jobs=None, outputs_refs_experiments=None): env_vars = [ get_env_var(name=API_KEY_NAME, value=get_settings_api_url()), get_env_var(name=constants.CONFIG_MAP_RUN_OUTPUTS_PATH_KEY_NAME, value=outputs_path), get_env_var(name=constants.CONFIG_MAP_RUN_DATA_PATHS_KEY_NAME, value=data_paths), get_from_app_secret('POLYAXON_INTERNAL_SECRET_TOKEN', 'polyaxon-internal-secret-token'), ] if log_level: env_vars.append( get_env_var(name=constants.CONFIG_MAP_LOG_LEVEL_KEY_NAME, value=log_level)) if logs_path: env_vars.append( get_env_var(name=constants.CONFIG_MAP_RUN_LOGS_PATH_KEY_NAME, value=logs_path)) refs_outputs = {} outputs_jobs_paths = get_paths_from_specs(specs=outputs_refs_jobs) if outputs_jobs_paths: refs_outputs['jobs'] = outputs_jobs_paths outputs_experiments_paths = get_paths_from_specs( specs=outputs_refs_experiments) if outputs_experiments_paths: refs_outputs['experiments'] = outputs_experiments_paths if refs_outputs: env_vars.append( get_env_var(name=constants.CONFIG_MAP_REFS_OUTPUTS_PATHS_KEY_NAME, value=refs_outputs)) return env_vars