Пример #1
0
 def get_uris(self) -> List[str]:
     # TODO(architkulkarni): this should programmatically be extended with
     # URIs from all plugins.
     plugin_uris = []
     if "working_dir" in self:
         plugin_uris.append(self["working_dir"])
     if "py_modules" in self:
         for uri in self["py_modules"]:
             plugin_uris.append(uri)
     if "conda" in self:
         uri = get_conda_uri(self)
         if uri is not None:
             plugin_uris.append(uri)
     if "pip" in self:
         uri = get_pip_uri(self)
         if uri is not None:
             plugin_uris.append(uri)
Пример #2
0
    def _proto_runtime_env(self):
        if self.__proto_runtime_env:
            return self.__proto_runtime_env
        proto_runtime_env = ProtoRuntimeEnv()
        proto_runtime_env.working_dir = self.get("working_dir", "")
        if "working_dir" in self:
            proto_runtime_env.uris.working_dir_uri = self["working_dir"]
        if "py_modules" in self:
            proto_runtime_env.python_runtime_env.py_modules.extend(
                self["py_modules"])
            for uri in self["py_modules"]:
                proto_runtime_env.uris.py_modules_uris.append(uri)
        if "conda" in self:
            uri = get_conda_uri(self)
            if uri is not None:
                proto_runtime_env.uris.conda_uri = uri
        if "pip" in self:
            uri = get_pip_uri(self)
            if uri is not None:
                proto_runtime_env.uris.pip_uri = uri
        env_vars = self.get("env_vars", {})
        proto_runtime_env.env_vars.update(env_vars.items())
        if "_ray_release" in self:
            proto_runtime_env.extensions["_ray_release"] = str(
                self["_ray_release"])
        if "_ray_commit" in self:
            proto_runtime_env.extensions["_ray_commit"] = str(
                self["_ray_commit"])
        if "_inject_current_ray" in self:
            proto_runtime_env.extensions["_inject_current_ray"] = str(
                self["_inject_current_ray"])
        _build_proto_pip_runtime_env(self, proto_runtime_env)
        _build_proto_conda_runtime_env(self, proto_runtime_env)
        _build_proto_container_runtime_env(self, proto_runtime_env)
        _build_proto_plugin_runtime_env(self, proto_runtime_env)

        self.__proto_runtime_env = proto_runtime_env
        return self.__proto_runtime_env
Пример #3
0
 def conda_uri(self) -> Optional[str]:
     if "conda" in self:
         return get_conda_uri(self)
     return None