Exemplo n.º 1
0
def resolve(run: BaseRun, compiled_at: datetime = None, resolver_cls=None):
    resolver_cls = resolver_cls or CorePlatformResolver
    try:
        project = run.project
        return resolver.resolve(
            run=run,
            compiled_operation=V1CompiledOperation.read(run.content),
            owner_name=project.owner.name,
            project_name=project.name,
            project_uuid=project.uuid.hex,
            run_uuid=run.uuid.hex,
            run_name=run.name,
            run_path=run.subpath,
            resolver_cls=resolver_cls,
            params=None,
            compiled_at=compiled_at,
            created_at=run.created_at,
            cloning_kind=run.cloning_kind,
            original_uuid=run.original.uuid.hex if run.original_id else None,
        )
    except (
        AccessNotAuthorized,
        AccessNotFound,
        MarshmallowValidationError,
        PolyaxonSchemaError,
        ValidationError,
    ) as e:
        raise PolyaxonCompilerError("Compilation Error: %s" % e) from e
Exemplo n.º 2
0
def make(
    owner_name: str,
    project_name: str,
    project_uuid: str,
    run_name: str,
    run_uuid: str,
    run_path: str,
    compiled_operation: V1CompiledOperation,
    params: Optional[Dict],
    default_sa: str = None,
    internal_auth: bool = False,
    default_auth: bool = False,
    converters: Dict[str, Any] = converter.CORE_CONVERTERS,
):
    resolver_obj, compiled_operation = resolver.resolve(
        compiled_operation=compiled_operation,
        owner_name=owner_name,
        project_name=project_name,
        project_uuid=project_uuid,
        run_name=run_name,
        run_path=run_path,
        run_uuid=run_uuid,
        params=params,
    )
    return converter.convert(
        namespace=resolver_obj.namespace,
        owner_name=resolver_obj.owner_name,
        project_name=resolver_obj.project_name,
        run_name=resolver_obj.run_name,
        run_path=resolver_obj.run_path,
        run_uuid=resolver_obj.run_uuid,
        compiled_operation=compiled_operation,
        connection_by_names=resolver_obj.connection_by_names,
        internal_auth=internal_auth,
        artifacts_store=resolver_obj.artifacts_store,
        secrets=resolver_obj.secrets,
        config_maps=resolver_obj.config_maps,
        polyaxon_sidecar=resolver_obj.polyaxon_sidecar,
        polyaxon_init=resolver_obj.polyaxon_init,
        default_sa=default_sa,
        converters=converters,
        default_auth=default_auth,
    )
Exemplo n.º 3
0
def resolve(run: BaseRun, resolver_cls=None):
    resolver_cls = resolver_cls or CorePlatformResolver
    try:
        project = run.project
        return resolver.resolve(
            run=run,
            compiled_operation=V1CompiledOperation.read(run.content),
            owner_name=project.owner.name,
            project_name=project.name,
            project_uuid=project.uuid.hex,
            run_uuid=run.uuid.hex,
            run_name=run.name,
            run_path=run.subpath,
            resolver_cls=resolver_cls,
            params=None,
        )
    except (
            AccessNotAuthorized,
            AccessNotFound,
            ValidationError,
            PolyaxonSchemaError,
    ) as e:
        raise PolyaxonCompilerError("Compilation Error: %s" % e) from e