Data Exercise 2.2: Using Stash for Large Shared Data¶
This exercise will use a BLAST workflow to demonstrate the functionality of StashCache for transferring input files to jobs on OSG.
Because our individual blast jobs from Exercise 2.1 would take a bit longer
with a larger database (too long for an workable exercise), we'll imagine for this exercise that our
pdbaa_files.tar.gz file is too large for a web proxy (larger than ~1 GB).
For this exercise, we will use the input from Exercise 2.1, but instead of using the web proxy for the
we will place it in Stash via the OSG Connect server.
Stash is connected to a distributed set of caches spread across the U.S. They are connected with high bandwidth connections to each other, and to the data origin servers, where your data is originally placed.
We will be using the command
stashcp to copy files from Stash to the execute hosts. It has a
cp like syntax.
- Make sure you're logged in to
- Copy the following files from the previous Exercise 2.1 to a new directory in
- Your most recent submit file (probably named
Place the Database in Stash¶
Copy to your
public space on OSG Connect¶
StashCache provides a public space for you to store data which can be accessed through the caching servers.
First, you need to move your BLAST database into this public directory.
You have already placed files in your
/public directory in the previous exercise in order for it to be
accessible to the HTTP proxies.
The same directory is accessible to StashCache.
public directory name indicates, your files placed in the
public directory will be accessible to anyone's
jobs if they know how to use
stashcp, though no one else will be able to edit the files, since only you can place or
change files in your
For your own work in the future, make sure that you never put any sensitive data in such locations.
Check the file on OSG Connect¶
Next, you can check for the file and test the command that we'll use in jobs on the OSG Connect login node:
[email protected] $ ls /public/<USERNAME>
Now, load the
stashcache module, which will allow you to test a copy of the file from StashCache into your
[email protected] $ module load stashcache [email protected] $ stashcp /osgconnect/public/<USERNAME>/pdbaa_files.tar.gz ./
Replacing all instances of
<USERNAME> with your username on
You should now see the
pdbaa_files.tar.gz file in your current directory.
Notice that we had to include the
/osgconnect/public and your username in the file path for
stashcp, which make sure you're
copying from your
Modify the Submit File and Wrapper¶
You will have to modify the wrapper and submit files to use Stash:
At the top of the wrapper script (after
#!/bin/bash), add the lines that load the
stashcachemodule and to copy the
pdbaa_files.tar.gzfile into the current directory of the job:
module load stashcache stashcp /osgconnect/public/<USERNAME>/pdbaa_files.tar.gz ./
<USERNAME>with your own username.
Since HTCondor will no longer transfer or download the file for you, make sure to add the following line (or modify your existing
rmcommand, if you're confident) from your wrapper script to make sure the
pdbaa_files.tar.gzfile is also deleted and not copied back as perceived output.
export http_proxylines from the job wrapper script
Add the following line to the submit file and update the "requirements" statement to require servers with OSG Connect modules (for accessing the
stashcpmodule), somewhere before the word
+WantsStashCache = true requirements = (OSGVO_OS_STRING == "RHEL 7") && (HAS_MODULES =?= true)
Remove the HTTP address in the
Confirm that your queue statement is correct for the current directory. It should be something like:
queue inputfile matching mouse_rna.fa.*
mouse_rna.fa.* files exist in the current directory (you should have copied a few them from the previous exercise
Submit the Job¶
Now submit and monitor the job! If your 100 jobs from the previous exercise haven't started running yet, this job will not yet start. However, after it has been running for ~2 minutes, you're safe to continue to the next exercise!
Note: Keeping Stash 'Clean'¶
Just as for data on a web proxy, it is VERY important to remove old files from Stash when you no longer need them,
especially so that you'll have plenty of space for such files in the future.
For example, you would delete (
rm) files from
login04.osgconnect.net when you don't need them there
anymore, but only after all jobs have finished.
The next time you use Stash after the school, remember to first check for old files that you can delete.
Once completed, move onto the next exercise: Using Stash for unique large input