Skip to content

Commit

Permalink
finish vscode start scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Glonek committed Nov 16, 2022
1 parent 9f5a086 commit 5fecc64
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/cmdClientConfigureVSCode.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ func (c *clientConfigureVSCodeCmd) Execute(args []string) error {
if err != nil {
return err
}
a.opts.Client.Stop.ClientName = c.ClientName
a.opts.Client.Stop.Machines = c.Machines
err = a.opts.Client.Stop.runStop(nil)
if err != nil {
return err
}
a.opts.Client.Start.ClientName = c.ClientName
a.opts.Client.Start.Machines = c.Machines
err = a.opts.Client.Start.runStart(nil)
if err != nil {
return err
}
log.Print("Done, to access vscode, run `aerolab client list` to get the IP, and then visit http://IP:8080 in your browser")
return nil
}
25 changes: 19 additions & 6 deletions src/cmdClientDoVSCode.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *clientConfigureVSCodeCmd) parseKernelsToSwitches(k string) ([]string, e
kernels := strings.Split(k, ",")
if len(kernels) == 0 || kernels[0] == "" || k == "" {
// return []string{"-j", "-p", "-n", "-g", "-d", "-o", "-s"}, nil
return []string{"-j", "-p", "-g", "-d", "-o", "-s"}, nil
return []string{"-j", "-p", "-g", "-d"}, nil
}
rval := []string{}
for _, kernel := range kernels {
Expand All @@ -70,15 +70,15 @@ func (c *clientConfigureVSCodeCmd) parseKernelsToSwitches(k string) ([]string, e
return nil, errors.New("unsupported kernel selected")
}
}
rval = append(rval, "-o", "-s")
//rval = append(rval, "-o", "-s")
return rval, nil
}

func (c *clientAddVSCodeCmd) parseKernelsToSwitches(k string) ([]string, error) {
kernels := strings.Split(k, ",")
if len(kernels) == 0 || kernels[0] == "" || k == "" {
// return []string{"-i", "-j", "-p", "-n", "-g", "-d", "-s"}, nil
return []string{"-i", "-j", "-p", "-g", "-d", "-s"}, nil
return []string{"-i", "-j", "-p", "-g", "-d"}, nil
}
rval := []string{"-i"}
for _, kernel := range kernels {
Expand All @@ -95,7 +95,7 @@ func (c *clientAddVSCodeCmd) parseKernelsToSwitches(k string) ([]string, error)
return nil, errors.New("unsupported kernel selected")
}
}
rval = append(rval, "-s")
//rval = append(rval, "-s")
return rval, nil
}

Expand Down Expand Up @@ -145,6 +145,19 @@ func (c *clientAddVSCodeCmd) addVSCode(args []string) error {
if err != nil {
return err
}

a.opts.Client.Stop.ClientName = c.ClientName
a.opts.Client.Stop.Machines = c.Machines
err = a.opts.Client.Stop.runStop(nil)
if err != nil {
return err
}
a.opts.Client.Start.ClientName = c.ClientName
a.opts.Client.Start.Machines = c.Machines
err = a.opts.Client.Start.runStart(nil)
if err != nil {
return err
}
log.Print("Done, to access vscode, run `aerolab client list` to get the IP, and then visit http://IP:8080 in your browser")
return nil
}
Expand Down Expand Up @@ -262,7 +275,7 @@ function knet() {
function start() {
cd /
su - -c "nohup /opt/autoload/code.sh > /var/log/starter.log 2>&1 &"
/opt/autoload/code.sh
echo "Started"
}
Expand Down Expand Up @@ -314,7 +327,7 @@ $optjava && [ ! -f /opt/steps/kjava ] && kjava && touch /opt/steps/kjava
$optdotnet && [ ! -f /opt/steps/knet ] && knet && touch /opt/steps/knet
$optstop && stop
$optstart && start
exit 0
# ./install.sh -i -j -p -g -d -s # install, install kernels, start
# ./install.sh -i # install
# ./install.sh -j -p -g -d # install kernels
Expand Down
8 changes: 8 additions & 0 deletions src/cmdClientStartStopDestroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func (c *clientStartCmd) Execute(args []string) error {
if earlyProcess(args) {
return nil
}
return c.runStart(args)
}

func (c *clientStartCmd) runStart(args []string) error {
log.Println("Running client.start")
b.WorkOnClients()
err := c.Machines.ExpandNodes(string(c.ClientName))
Expand Down Expand Up @@ -123,6 +127,10 @@ func (c *clientStopCmd) Execute(args []string) error {
if earlyProcess(args) {
return nil
}
return c.runStop(args)
}

func (c *clientStopCmd) runStop(args []string) error {
b.WorkOnClients()
log.Println("Running client.stop")
err := c.Machines.ExpandNodes(string(c.ClientName))
Expand Down

0 comments on commit 5fecc64

Please sign in to comment.