Overview
If you have a supercomputing allocation, then your workflow may involve some of these steps.
The delegate command is intended for performing automated authentication in the context of a (non-interactive) submitted job.
This means that pshell commands can be run inside a script without the need to type in username and password.
There are two ways of executing pshell commands:
- a single command to run
- a series of sequential commands supplied via an input script
iblis:~/dev/mfclient> ./pshell.py -h usage: pshell.py [-h] [-c CONFIG] [-i SCRIPT] [-d] [command] pshell help positional arguments: command a single command to execute optional arguments: -h, --help show this help message and exit -c CONFIG the server in $HOME/.mf_config to connect to -i SCRIPT input text file containing commands -d turns debugging on
Exercises
Exercise 1 - create a delegate and check that pshell is using it.
You will only be able to do this exercise if you've logged in with a Pawsey user account. Delegate identities are not allowed to create further delegates.
Perform the following:
- run pshell and log in using your Pawsey credentials
- examine your identity
- create a delegate
- exit and restart pshell
- check your identity
Exercise 2 - running commands from the shell
Run pshell from the command line to:
- check your identity,
- list the contents of the Data Team/testfiles remote folder,
- download a single file.
Exercise 3 - script a task to download a file in your directory.
Perform the following:
- create a text file to change into the /projects/Data Team/testfiles directory and download a file
- use this script as input to pshell
Exercise 4 - script a task that attempts to perform something that will fail (eg remove a directory that doesn't exist) and correctly report that the script encountered an error.
Perform the following:
- write a shell (eg bash) script to run a single pshell command to remove the remote folder /idontexist
- based on the exit code being 0 if successful and non 0 on failure, report that there was a problem