From fccfa4da09d2e96628ae59dded5656c2f2c37b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=AE=E4=B8=AD=E4=BA=8C=E7=97=85=E3=81=AB?= =?UTF-8?q?=E7=88=86=E7=84=94=E3=82=92=EF=BC=81?= Date: Tue, 13 Apr 2021 14:39:46 +0800 Subject: [PATCH] update cli --- Distribute_computing/HPC_cluster/Taskhost.vb | 27 ++++++++++++++++---- Distribute_computing/Taskhost.d/Program.vb | 19 +++++++++++++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Distribute_computing/HPC_cluster/Taskhost.vb b/Distribute_computing/HPC_cluster/Taskhost.vb index 3f151a7..1cf817f 100644 --- a/Distribute_computing/HPC_cluster/Taskhost.vb +++ b/Distribute_computing/HPC_cluster/Taskhost.vb @@ -85,20 +85,37 @@ End Function ''' ''' ```bash -''' /parallel +''' /parallel --master <port> [--host <localhost, default=localhost> --socket <tempdir> --imageName <docker_imageName>] ''' ``` ''' Run task parallel ''' ''' - -Public Function Parallel() As Integer -Dim cli = GetParallelCommandLine(internal_pipelineMode:=True) +''' The host location of the master node, default is localhost, means parallel computing on one host node, different host ip means cluster computing. +''' +''' The tcp port of the master node that opened to current parallel slave node. +''' +''' A data location on shared storage of your cluster nodes if run parallel in cluster computing mode. +''' +''' The docker image name if your cluster application is deployed via docker. +''' +Public Function Parallel(master As String, Optional host As String = "localhost", Optional socket As String = "", Optional imagename As String = "") As Integer +Dim cli = GetParallelCommandLine(master:=master, host:=host, socket:=socket, imagename:=imagename, internal_pipelineMode:=True) Dim proc As IIORedirectAbstract = RunDotNetApp(cli) Return proc.Run() End Function -Public Function GetParallelCommandLine(Optional internal_pipelineMode As Boolean = True) As String +Public Function GetParallelCommandLine(master As String, Optional host As String = "localhost", Optional socket As String = "", Optional imagename As String = "", Optional internal_pipelineMode As Boolean = True) As String Dim CLI As New StringBuilder("/parallel") Call CLI.Append(" ") + Call CLI.Append("--master " & """" & master & """ ") + If Not host.StringEmpty Then + Call CLI.Append("--host " & """" & host & """ ") + End If + If Not socket.StringEmpty Then + Call CLI.Append("--socket " & """" & socket & """ ") + End If + If Not imagename.StringEmpty Then + Call CLI.Append("--imagename " & """" & imagename & """ ") + End If Call CLI.Append($"/@set --internal_pipeline={internal_pipelineMode.ToString.ToUpper()} ") diff --git a/Distribute_computing/Taskhost.d/Program.vb b/Distribute_computing/Taskhost.d/Program.vb index 3ec4deb..392c18c 100644 --- a/Distribute_computing/Taskhost.d/Program.vb +++ b/Distribute_computing/Taskhost.d/Program.vb @@ -42,6 +42,7 @@ #End Region Imports System.ComponentModel +Imports System.Net Imports Microsoft.VisualBasic.CommandLine Imports Microsoft.VisualBasic.CommandLine.Reflection @@ -72,9 +73,25 @@ Module Program ''' ''' - + [--host --socket --imageName ]")> + + + + Public Function Parallel(args As CommandLine) As Integer + Dim master As Integer = args <= "--master" + Dim host As String = args("--host") Or "localhost" + Dim socket As String = args <= "--socket" + Dim imageName As String = args <= "--imageName" End Function