NEMO2/Workspaces/Advanced Features

From bwHPC Wiki
< NEMO2‎ | Workspaces
Revision as of 17:58, 12 May 2026 by M Janczyk (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For basic daily usage see the main Workspaces guide.

Creating Workspaces

  $ ws_allocate myWs 100

Returns the workspace path, e.g. /work/classic/$USER-myWs. Running the same command again is safe — it returns the existing workspace path.

Capture path in variable:

  $ WORKSPACE=$(ws_allocate myWs 100)
  $ cd "$WORKSPACE"

Common options:

  $ ws_allocate -g myWs 100                # Group-readable workspace
  $ ws_allocate -G projectgroup myWs 100   # Group-writable workspace
  $ ws_allocate -r 7 myWs 100              # Reminder 7 days before expiry
  $ ws_allocate -c "ML training data" myWs 100   # Add comment (shown in ws_list -l)
  $ ws_allocate -x myWs 100                # Extend existing workspace
  $ ws_allocate -x -u alice myWs 100       # Extend Alice's group workspace
  $ ws_allocate -r 7 -x myWs 0             # Update reminder only (no extension)
Option Description
-g Group-readable workspace
-G <groupname> Group-writable workspace. Set default in ~/.ws_user.conf
-m <email> Custom email for reminders (overrides identity provider email)
-r <days> Reminder n days before expiration
-c <comment> Comment shown in ws_list -l
-x Extend existing workspace
-u <username> Target another user's workspace (requires -G)

Using workspaces in batch jobs:

Create the workspace once on the login node, then use ws_find in the job script:

#!/bin/bash
#SBATCH --job-name=my_job

WORKSPACE=$(ws_find myProject)
cd "$WORKSPACE"

./my_program --input input.dat --output results.dat

User Defaults: ~/.ws_user.conf

Set defaults so you never forget important options. The file is in YAML format:

duration:  100
reminder:  7
groupname: projectgroup

Important: The first line must be a setting, not a comment. Some versions interpret a leading # as an email address.

With the config above, ws_allocate myWs automatically creates a 100-day workspace with a 7-day reminder for the default group — no extra flags needed.

Setting Description
duration: Default lifetime in days
reminder: Days before expiration for reminder
groupname: Default group for -G (see Sharing)
mail: Override notification email (optional)

Listing Workspaces

  $ ws_list                                # All your workspaces
  $ ws_list -Rr                            # Sort by remaining time (soonest first)
  $ ws_list -g                             # Include group workspaces

Example output:

id: myWs
   workspace directory  : /work/classic/$USER-myWs
   remaining time       : 6 days 23 hours
   creation time        : Thu Apr 17 09:23:41 2025
   expiration time      : Mon May 26 09:23:41 2025
   available extensions : 98
Option Description
-l Long listing (shows creation time, comment, extensions remaining)
-R Show remaining time as human-readable
-r Reverse sort order
-s Sort by creation time
-g Include group workspaces (not just owned)

Finding Workspace Paths

Returns the full path — primarily useful in scripts:

  $ ws_find myWs
  /work/classic/$USER-myWs
  $ WORKSPACE=$(ws_find myWs)
  $ cd "$WORKSPACE"

Extending Workspaces

  $ ws_extend myWs 100                      # Extend by 100 days (same as ws_allocate -x)

Note: Expiry is recalculated from now. Extending too early reduces remaining time; extending near expiry gives maximum benefit.

Group members can extend each other's workspaces:

  $ ws_allocate -x -u alice myWs 100        # Requires workspace created with -G

Each extension uses one of the 100 available extensions. Check remaining extensions with ws_list -l.

Releasing Workspaces

  $ ws_release myWs

The workspace directory is immediately moved out of reach. The data is permanently deleted at the next nightly expirer run — ws_restore is possible until then.

Do not rely on being able to restore a released workspace. If you have important data, archive it before releasing.

--delete-data skips even that window and deletes immediately (cannot be restored). Only use this if you are certain the data is no longer needed.

Restoring Workspaces

Restore workspaces that expired naturally (reached end of lifetime) within the 30-day grace period:

  $ ws_restore -l                          # (1) List restorable workspaces
  $ ws_allocate restored 100               # (2) Create target workspace
  $ ws_restore username-myWs-0 restored    # (3) Restore

Use the full name from ws_restore -l (includes username prefix and timestamp), not the short name.

Released workspaces (deleted with ws_release) can be restored with ws_restore until the next nightly expirer run — after that they are permanently deleted.

If the workspace is not listed, it has been permanently deleted — not recoverable by anyone.

Option Description
-l List restorable workspaces
-u <username> Restore another user's workspace (requires permission)

Workspace Links

Creates a directory of symlinks to all your workspaces for quick navigation:

  $ ws_register ~/workspaces
  $ ls ~/workspaces/
  myWs -> /work/classic/$USER-myWs

Re-run after creating new workspaces to keep the links up to date.

Sharing

NEVER use chmod 777 / chmod o+rwx! Making workspaces world-readable is a security policy violation — use the methods below.

Group workspaces (recommended)

  $ ws_allocate -g myWs 100                # Group-readable (read-only for group)
  $ ws_allocate -G projectgroup myWs 100   # Group-writable (recommended for teams)

Set groupname in ~/.ws_user.conf so you don't have to type it every time.

Benefits: team members can extend the workspace, ws_list -g shows it to everyone in the group, and new files automatically inherit group ownership.

Read-only sharing after creation

Share an existing workspace read-only with specific users outside your group:

  $ ws_share share myWs alice bob          # Grant read access
  $ ws_share unshare myWs alice            # Remove access
  $ ws_share list myWs                     # Show who has access

ACLs (per-user fine-grained)

Use setfacl when -g/-G and ws_share don't cover your needs.

  $ DIR=$(ws_find my_workspace)
  $ setfacl -Rm user:alice:rX,default:user:alice:rX "$DIR"   # Read-only for alice
  $ setfacl -Rm user:bob:rwX,default:user:bob:rwX  "$DIR"    # Read-write for bob
  $ getfacl "$DIR"                                           # View current ACLs
  $ setfacl -Rb "$DIR"                                       # Remove all ACLs

-R recursive, default: makes new files inherit the ACL, X execute only on dirs/executables.

Workspace Handover

When a team member leaves or transfers a project, their workspaces can be handed over without data loss.

Preparation (before someone leaves)

-G groupname can only be set at creation time. Always create shared research data with it from the start:

  $ ws_allocate -G projectgroup -c "ML training data – contact alice" myWs 100

This ensures:

  • Group members can see the workspace with ws_list -g
  • Any group member can extend it: ws_allocate -x -u alice myWs 100
  • Data remains accessible after the original owner's account is deactivated

To ensure someone else receives expiry reminders, there are two options:

  • Add their email to ~/.ws_user.conf of the owner (or use -m email at allocate time):
mailaddress: alice@uni-freiburg.de,backup@uni-freiburg.de
  • Or actively take over the reminders as the new responsible person:
  $ ws_allocate -r 7 -u alice -x myWs 0   # Redirect reminders to yourself

After the owner has left

If the workspace was created with -G groupname, a group member can keep it alive:

  $ ws_list -g                                  # Find group workspaces
  $ ws_allocate -x -u formercolleague myWs 100  # Extend (while still restorable)

If the workspace has already expired, an authorized group member or administrator can restore it:

  $ ws_restore -u formercolleague -l        # List their restorable workspaces
  $ ws_allocate newname 100
  $ ws_restore -u formercolleague formercolleague-myWs-0 newname

Workspaces without group access

If the workspace was created without -g/-G, contact the HPC support team for assistance during the grace period (30 days after expiry).

Reminders

Reminders are automatic. The notification goes to your identity provider email address.

Customize reminder timing at workspace creation:

  $ ws_allocate -r 7 myWs 100              # Reminder 7 days before expiry

Custom email address:

  $ ws_allocate -m custom@example.com myWs 100

Update reminder timing (or take over reminders) without extending:

  $ ws_allocate -r 7 -x myWs 0            # Change timing only
  $ ws_allocate -r 7 -u alice -x myWs 0   # Take over reminders for Alice's workspace

The last command is useful when taking responsibility for a colleague's workspace.

Quotas & Limits

Parameter Value
Default lifetime 30 days
Maximum lifetime 100 days
Maximum extensions 100 times
Storage quota 5 TiB per workspace
Grace period (expired workspaces) 30 days (recoverable with ws_restore)
Grace period (released workspaces) next nightly expirer run (not reliably recoverable)

Check quota:

  $ nemoquota                               # HOME + workspace quotas
  $ df --si $(ws_find myWs)                 # Size of a specific workspace

Released workspaces count toward quota until the nightly cleanup runs. Use ws_release --delete-data for immediate relief (irreversible).

Best Practices

  1. Set up ~/.ws_user.conf — defaults save time and prevent mistakes
  2. Use -G groupname for research data — essential for handover and collaboration
  3. Create workspaces on the login node — use ws_find in job scripts, don't create inside jobs
  4. Monitor with ws_list -Rr — sort by remaining time to catch workspaces about to expire
  5. Archive before expiry — workspaces are not backed up
  6. Clean up finished workspaces — ws_release frees quota and reduces clutter

Single-node temporary files belong in $TMPDIR, not workspaces.