Workspaces/Advanced Features/ws allocate

From bwHPC Wiki
< Workspaces‎ | Advanced Features
Revision as of 15:12, 2 December 2025 by M Janczyk (talk | contribs) (Created page with "= ws_allocate - Create and Extend Workspaces = {| class="wikitable" |- !style="width:40%" | Works on cluster !style="width:10%" | bwUC 3.0 !style="width:10%" | BinAC2 !style="width:10%" | Helix !style="width:10%" | JUSTUS 2 !style="width:10%" | NEMO2 |- |<tt>ws_allocate -x -u</tt> (extend other user's workspace) | style="text-align:center;" | | style="text-align:center;" | | style="text-align:center;" | | style="text-align:center;" | |style="background-color:#90EE9...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ws_allocate - Create and Extend Workspaces

Works on cluster bwUC 3.0 BinAC2 Helix JUSTUS 2 NEMO2
ws_allocate -x -u (extend other user's workspace)

Basic Usage

Execution of:

  $ ws_allocate myWs 30

e.g. returns:

  Workspace created. Duration is 720 hours. 
  Further extensions available: 3
  /work/workspace/scratch/username-myWs-0

The command returns the path to the new directory, which can be captured in a variable:

  $ SCRDIR=$(ws_allocate myWs 10)

Important: Creating a workspace a second time with the same command is a no-operation - it always returns the same path. This makes it safe and encouraged to use such a line in batch jobs which are part of a series of jobs working on the same data, no matter if the job was running before or not.

All Options and When to Use Them

Option Description When to Use
-F <filesystem> Specify the filesystem where the workspace should be created Optional - Most clusters have only one default filesystem. Use only when you need specific storage characteristics (speed, capacity) or to balance load across multiple filesystems. List available locations with ws_list -l or ws_find -l. See Filesystems guide.
-g Create a group-readable workspace Recommended when working in a team and others need to read your data. The workspace will be visible to group members with ws_list -g
-G <groupname> Create a group-writable workspace with sticky bit Recommended for collaborative work where team members need to write data. Ensures all created files belong to the group. Can be set as default in ~/.ws_user.conf
-m <mailaddress> Set email address for reminders Optional - Email addresses come from your identity provider. Only use this option to override with a different address. Can be set as default in ~/.ws_user.conf
-r <days> Set reminder to be sent n days before expiration Optional - Email reminders are sent automatically. Use this only to customize when the reminder starts (e.g., 3, 5, or 7 days before). Can be set as default in ~/.ws_user.conf
-x Extend an existing workspace Use when you need more time. Each extension consumes one of the available extensions
-u <username> Used with -x to extend another user's workspace Use when a group member is absent and their shared workspace needs extension. Requires group write access -G
-c <comment> Add a comment to the workspace Use to document the purpose of the workspace for yourself and collaborators
-d <duration> Duration in days (alternative to positional argument) Use if you prefer explicit option syntax: ws_allocate -n myWs -d 30
-n <name> Workspace name (alternative to positional argument) Use if you prefer explicit option syntax: ws_allocate -n myWs -d 30

Duration Settings

If you do not specify a lifetime, a default lifetime will be used (see the Cluster-Specific Workspace Limits). The maximum lifetime may be limited by the operations team. If you specify a longer lifetime, it will be capped to the maximum, and you will see a message that it was changed.

For more information read the program's help: $ ws_allocate -h or man ws_allocate

Using Workspaces in Batch Jobs

Recommended approach: Create your workspace manually before submitting jobs, then reference it in your job scripts using ws_find.

(1) Create workspace once (on login node):

  $ ws_allocate myProject 60

(2) Use in job scripts with ws_find:

#!/bin/bash
#SBATCH --job-name=my_job
#SBATCH --time=24:00:00

# Find existing workspace
WORKSPACE=$(ws_find myProject)

# Change to workspace
cd $WORKSPACE

# Your computation here
./my_program --input input.dat --output results.dat

Warning: Avoid using ws_allocate directly in job scripts that run frequently. While ws_allocate is safe to call multiple times on the same workspace name (it returns the existing workspace), you should not create too many workspaces unnecessarily. Create workspaces manually when needed, then use ws_find in your job scripts to locate them.

See also: ws_find for finding workspace paths in scripts.