How to use Swiss Army Knife for an interactive/ssh session

Kristen
  • Edited

Although Swiss Army Knife is designed for non-interactive use, there are times when it is helpful to be able to use it interactively.

To get an interactive session, have Swiss Army Knife run the “sleep” command for the desired number of hours, and submit your job using the --ssh or --allow-ssh flag.

Example:

dx run --name swissinteractive --priority high --instance-type mem3_ssd2_v2_x2 --ssh -i cmd="/usr/bin/sleep 8h" swiss-army-knife

Tips for interactive Swiss Army Knife sessions:

  • Run at high priority so you don't get preempted while you're in the middle of working on something.
  • The --ssh flag will attempt to connect to your job automatically when it starts, but sometimes fails with “Cannot resolve hostname or hostkey”.  If that happens, you can connect using "dx ssh job-abc123" where job-abc123 is your job ID.
  • If you have exported files to Swiss Army Knife with -iin, you will be able to ssh before the files have finished copying. Be sure to check that any files have finished copying before you try to use them.
  • /mnt/project/ will work normally in an interactive Swiss Army Knife session
  • The “dx” commands will not work normally. To get the dx commands working, you will need to provide each command with the value stored in $DX_PROJECT_CONTEXT_ID, as demonstrated here in instructions for how to do that on Cloud Workstation.

Comments

0 comments

Please sign in to leave a comment.