SystemsHPSS Mass Storage |
Accessing HPSS - Usage Advice and ExamplesThis section advises and demonstrates some useful techniques for using HSI and ftp/pftp, including their use in batch scripts.
Some Advice on Efficient Use of HPSSAccessing HPSS in Batch Jobs Accessing HPSS in a Single Session Ordering Multiple-File Reads File can be aggregated into collections with the HTAR utility, allowing more efficient access to members of the collection. HTAR writes tar-like archive files directly into HPSS, with a companion index file to each archive. This allows subsequent reads of any subset of an htar archive's contents with only a single tape mount. File sets that were written unaggregated can be re-written with htar after being read. The cost of this rewriting is the extra storage resources used, since the original files are not removed. Example 1. Complete Batch Script Using PFTPThis example shows a batch script with pftp actions in it. In this more complex example, we show the use of both single and multiple-file movement commands, as well as directory change commands. Here, also, we show the "+" character used to bracket a "here document." This example also assumes that you have a ".netrc" file in your home directory with the appropriate encrypted password combination.
#!/bin/csh
# First, copy the source from the submitting directory
pftp -i -v archive <<+
cd my_HPSS_directory
mget data*
get source.f
quit
+
./myprog data outfile
# Save the output file in HPSS.
pftp -i -v archive <<+
cd my_HPSS_directory
put outfile
mput restart*
quit
+
exit
Example 2. Complete Batch Script Using HSIThis example shows a script containing HSI actions. In this example, we show the use of HSI commands that accomplish the same actions ftp does in Example 2, above. Note that in this case, a single-line command is used, so no "here-doc" is needed. This simplifies the script, and demonstrates some of HSI's advantages over pftp or ftp. This script assumes that you have previously interactively logged into HSI at least once to encrypt your username/password.
#!/bin/csh
# First, copy the data and program source from the
# submitting directory
hsi -h archive.nersc.gov "cd my_HPSS_directory; get data* source.f"
./myprog data outfile
# Save the output file in HPSS.
hsi -h archive.nersc.gov "cd my_HPSS_directory; put outfile; \
put restart*"
exit
Note that in the above, the individual hsi commands are separated by semicolons, (;) and the set of commands is contained in quotes, ("). The semicolons are necessary, and are currently the only allowed command separator. The quotes are required to prevent shell interpretation of wild card characters, and are recommended for general safety in one-liners. Note that the suppression of shell interpretation prevents the effective use of wild-card file and directory specifications in one-liners. Unlike an interactive HSI session, no termination command (e.g. exit, quit, etc.) is needed in a one-liner. In addition to one-line commands, HSI can also take input command sets from files. For more information on this see the HSI Documentation. |
![]() |
Page last modified: Mon, 11 Jan 2010 21:47:38 GMT Page URL: http://www.nersc.gov/nusers/systems/hpss/usage_examples.php Web contact: webmaster@nersc.gov Computing questions: consult@nersc.gov Privacy and Security Notice |
![]() |