Skip to content

start_interactive_app_from_command_line

Eric Franz edited this page May 26, 2020 · 1 revision

Overview

You can launch an iHPC session by the command line using the provided rake task:

batch_connect:new_session

When you run the rake task, it will need to be run under the same environment that the Dashboard web app is run under:

  • PWD will need to be the Dashboard App root
  • RAILS_ENV will need to be set to the rails environment the Dashboard App would be run under
  • RAILS_RELATIVE_URL_ROOT will need to be set to what the Dashboard App would use

So an example to launch an Owens desktop that is deployed at OSC under the app token sys/bc_desktop_v2/owens using the system-installed Dashboard App (production) would be run as:

# We need to be at the root of the Dashboard app
cd /var/www/ood/apps/sys/dashboard

# We set the environment to match the Dashboard app's environment
export RAILS_ENV=production
export RAILS_RELATIVE_URL_ROOT=/pun/sys/dashboard

# We launch our Owens desktop session
echo '{}' | bin/rake batch_connect:new_session BC_APP_TOKEN=sys/bc_desktop_v2/owens

where you pipe in the JSON session context (basically a JSON representation of the form parameters you'd see in the web form when you tried to submit an iHPC session).

If the session was launched successfully, then you should be able to navigate to the chosen Dashboard app in your browser and find your session under "Interactive Apps" => "Interactive Session".

Modify Session Context

To modify the context that the session is launched with (e.g., modify number of nodes or walltime) you need to provide a JSON formatted string to STDIN with the settings you want to use.

For the case of the Owens desktop, a session context JSON string can look like:

{
  "bc_num_hours": "1",
  "bc_num_slots": "1",
  "node_type": ":ppn=28",
  "bc_account": "",
  "bc_vnc_resolution": "2048x1152",
  "bc_email_on_started": "0"
}

You can then launch and Owens desktop session with this JSON string as:

# Set environment for the Dashboard app of your choosing
...

# Launch and Owens desktop session with user-defined context
bin/rake batch_connect:new_session BC_APP_TOKEN=sys/bc_desktop_v2/owens <<-EOF
{
  "bc_num_hours": "1",
  "bc_num_slots": "1",
  "node_type": ":ppn=28",
  "bc_account": "",
  "bc_vnc_resolution": "2048x1152",
  "bc_email_on_started": "0"
}
EOF
Clone this wiki locally