protected override ProcessExecInput OnCreateExecInputInfo(IActionContext context, string exchangePath, string inputFile, string outputFile)
        {
            _ = context ?? throw new ArgumentNullException(nameof(context));
            string RootDirInDocker    = "/anyjob";
            string PackageDirInDocker = System.IO.Path.Combine(RootDirInDocker, "packs", context.Name.Pack).ToUnixPath();

            string globalJarDirInLocal  = Path.GetFullPath(Path.GetDirectoryName(javaOptions.GlobalJarLibsPath));
            string globalJarDirInDocker = Path.Combine(RootDirInDocker, "global/java/").ToUnixPath();


            string exchangePathInDocker = Path.Combine(RootDirInDocker, "exchange").ToUnixPath();
            string inputFileInDocker    = Path.Combine(exchangePathInDocker, Path.GetFileName(inputFile)).ToUnixPath();
            string outputFileInDocker   = Path.Combine(exchangePathInDocker, Path.GetFileName(outputFile)).ToUnixPath();

            String classPathsInDocker = CombinClassPathInDocker(context.RuntimeInfo.WorkingDirectory, PackageDirInDocker, globalJarDirInLocal, globalJarDirInDocker);

            return(ProcessExecuter.BuildDockerProcess(javaOptions.DockerImage,
                                                      new[] { javaOptions.JavaPath, "-cp", classPathsInDocker, javaOptions.EntryClass, javaEntryInfo.ClassFullName, javaEntryInfo.MethodName, inputFileInDocker, outputFileInDocker },
                                                      PackageDirInDocker,
                                                      new Dictionary <string, string>
            {
                [context.RuntimeInfo.WorkingDirectory] = PackageDirInDocker,
                [globalJarDirInLocal] = globalJarDirInDocker,
                [exchangePath] = exchangePathInDocker
            },
                                                      new Dictionary <string, string>
            {
            },
                                                      string.Empty
                                                      ));
        }
Example #2
0
        private ProcessExecInput CreateDockerInputInfo(IActionContext context, string exchangePath, string inputFile, string outputFile)
        {
            string RootDirInDocker      = "/anyjob";
            string PackageDirInDocker   = System.IO.Path.Combine(RootDirInDocker, "packs", context.Name.Pack).ToUnixPath();
            string wrapperPathInDocker  = System.IO.Path.Combine(RootDirInDocker, "python_wrapper.py").ToUnixPath();
            string globalLibDirInLocal  = System.IO.Path.GetFullPath(pythonOption.GlobalPythonLibPath);
            string globalLibDirInDocker = System.IO.Path.Combine(RootDirInDocker, pythonOption.GlobalPythonLibPath).ToUnixPath();
            string exchangePathInDocker = System.IO.Path.Combine(RootDirInDocker, "exchange").ToUnixPath();
            string inputFileInDocker    = System.IO.Path.Combine(exchangePathInDocker, Path.GetFileName(inputFile)).ToUnixPath();
            string outputFileInDocker   = System.IO.Path.Combine(exchangePathInDocker, Path.GetFileName(outputFile)).ToUnixPath();

            string wrapperPathInLocal          = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, pythonOption.WrapperPath));
            string packNodeModulesPathInDocker = System.IO.Path.Combine(PackageDirInDocker, pythonOption.PackPythonLibPath).ToUnixPath();

            return(ProcessExecuter.BuildDockerProcess(
                       pythonOption.DockerImage,
                       new string[] { pythonOption.PythonPath, wrapperPathInDocker, pythonEntryInfo.Module, pythonEntryInfo.Method, inputFileInDocker, outputFileInDocker },
                       PackageDirInDocker,
                       new Dictionary <string, string>
            {
                [context.RuntimeInfo.WorkingDirectory] = PackageDirInDocker,
                [wrapperPathInLocal] = wrapperPathInDocker,
                [exchangePath] = exchangePathInDocker,
                [globalLibDirInLocal] = globalLibDirInDocker
            },
                       new Dictionary <string, string>
            {
                ["PYTHONPATH"] = JoinEnvironmentPaths(true, PackageDirInDocker, packNodeModulesPathInDocker, globalLibDirInDocker)
            },
                       string.Empty));
        }
        protected override ProcessExecInput OnCreateExecInputInfo(IActionContext context, string exchangePath, string inputFile, string outputFile)
        {
            _ = context ?? throw new ArgumentNullException(nameof(context));
            string RootDirInDocker    = "/anyjob";
            string PackageDirInDocker = System.IO.Path.Combine(RootDirInDocker, "packs", context.Name.Pack).ToUnixPath();

            string wrapperDirInLocal   = Path.GetFullPath(Path.GetDirectoryName(netCoreOptions.WrapperPath));
            string wrapperDirInDocker  = Path.Combine(RootDirInDocker, "global/netcore/").ToUnixPath();
            string wrapperPathInDocker = Path.Combine(wrapperDirInDocker, Path.GetFileName(netCoreOptions.WrapperPath)).ToUnixPath();


            string exchangePathInDocker = Path.Combine(RootDirInDocker, "exchange").ToUnixPath();
            string inputFileInDocker    = Path.Combine(exchangePathInDocker, Path.GetFileName(inputFile)).ToUnixPath();
            string outputFileInDocker   = Path.Combine(exchangePathInDocker, Path.GetFileName(outputFile)).ToUnixPath();

            return(ProcessExecuter.BuildDockerProcess(netCoreOptions.DockerImage,
                                                      new[] { netCoreOptions.DotnetPath, wrapperPathInDocker, entryInfo.Assembly, entryInfo.Type, entryInfo.Method, inputFileInDocker, outputFileInDocker },
                                                      PackageDirInDocker,
                                                      new Dictionary <string, string>
            {
                [context.RuntimeInfo.WorkingDirectory] = PackageDirInDocker,
                [wrapperDirInLocal] = wrapperDirInDocker,
                [exchangePath] = exchangePathInDocker
            },
                                                      new Dictionary <string, string>
            {
            },
                                                      string.Empty
                                                      ));
        }