While developing tools, we need someplace to store temporary files, calculation results, and data uploaded by users. Here's a brief guide to best practices.
- Session variable
- Files in User Space
- Files in Shared Space
The tool's SESSION variable
Each time a Ghub user runs a tool, a session number is assigned to the tool run. This session number is used to identify the run. You can assume it's unique.
Notice that your current SESSION number is visible in the URL when you are running a tool. Here's an example:
Since SESSION is an environment variable, it is accessible as $SESSION in the shell.
Files in user space
User space is ideal for temporary or small input or output files.
Temporary files at runtime
Temporary files that are generated by a tool at runtime should be written to the default session directory using the SESSIONDIR environment variable. As the tool developer, you should ensure the tool removes these temporary files when it no longer needs them, as they will otherwise stay in the user's home directory and consume some of their quota.
Session directories take the form:
Simulation result files
Simulation output files that are generated by a tool should be written to the results directory using the RESULTSDIR environment variable. This directory is created in the user's home directory. The tool may read from that directory and present a list of its files to the user.
Results directories take the form:
Note that the "data" subdirectory in your tool's directory structure will not be accessible for writing temporary files at runtime. Please use SESSIONDIR and RESULTSDIR instead.
Files in shared space: /data
Shared spaces may be appropriate for storing larger or frequently-needed files. Contact Ghub if you need help using these shared spaces.
Shared data files for a given tool
By convention, a directory called "/data/tools/toolname" can be set with permissions of 775, providing write access only to members listed as developers of the tool (app-toolname group). Data stored here is intended to be used in a tool. The /data directory is mounted in tool containers.
Shared data files for a given group and its members
By convention, a directory called "/data/groups/groupname" can be set with permissions of 775, providing write access only to group members. Data stored here is intended to be used in a tool accessible to that group. The /data directory is mounted in tool containers.
Refer here for further information and tips on storage for tool data, and environment variables in tool sessions:
KB article on Environment Variables
Comments on this entry
There are no comments on this entry.
Post a comment