AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Unlicense Self-run

Running Stata

skill-yale-som-hpc-claude-code-marketplace-running-stata · by yale-som-hpc

Run Stata batch jobs on the Yale SOM HPC cluster with logs, scratch temp, CPU matching, and license courtesy. TRIGGER when writing Stata sbatch scripts for the Yale SOM HPC cluster, choosing Stata/MP cores there, or diagnosing Stata batch jobs/licenses on the cluster.

No reviews yet
0 installs
11 views
0.0% view→install

Install

$ agentstack add skill-yale-som-hpc-claude-code-marketplace-running-stata

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-yale-som-hpc-claude-code-marketplace-running-stata)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Running Stata? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Running Stata

Rule: run Stata in batch jobs, write logs, put temp files on scratch, and request only the cores Stata will use.

What you get: the stata module is a complete MP install — no package-bootstrap step (unlike R, whose base module ships nothing). ssc install packages land in your personal ado directory.

Slurm template

#!/bin/bash
#SBATCH --job-name=stata-job
# default_queue caps at 4h; for long/large work use cpunormal or gpunormal (see managing-jobs)
#SBATCH --partition=default_queue
#SBATCH --time=01:00:00
#SBATCH --cpus-per-task=4
#SBATCH --mem=16G
#SBATCH --output=logs/%x_%j.out

set -euo pipefail

module purge
module load stata

# These only affect external BLAS calls; native Stata/MP threading is controlled
# by `set processors` (below), not by these. Harmless to keep for portability.
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1}
export OPENBLAS_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1}
# The stata/19 module defaults STATATMP=/gpfs/scratch60; override for per-job isolation:
export STATATMP=/gpfs/scratch60/$USER/stata-tmp/${SLURM_JOB_ID}

mkdir -p "$STATATMP" logs
trap 'rm -rf "$STATATMP"' EXIT

cd /gpfs/project/myproject/code
stata-mp -b do src/main.do

Two log gotchas, both verified on the cluster:

  • Read the .log, not the .out. Under stata-mp -b, Stata sends all output to its own log file; the Slurm --output .out file ends up empty. The log using inside your do-file (below) is what you read.
  • stata-mp -b do src/main.do also writes main.log in the working directory (named after the do-file), in addition to your log using. Either expect/clean up that stray file or name your log using differently.
  • Check the log for errors — batch mode can exit 0 on a Stata error. Grep the .log for an r(###) return code; set -e will not catch a do-file error on its own.

Do-file preamble

capture log close _all
local jobid : env SLURM_JOB_ID
if "`jobid'" == "" local jobid local
log using "logs/main_`jobid'.log", replace text

local ncpus : env SLURM_CPUS_PER_TASK
if "`ncpus'" == "" local ncpus 1
set processors `ncpus'

local statatmp : env STATATMP
di "STATATMP=`statatmp'"

set more off
version 19

Memory hygiene

compress
describe
memory report

Use frames, tempfile, and preserve/restore deliberately. Drop unneeded variables before merges.

Job arrays

local task_id : env SLURM_ARRAY_TASK_ID
if "`task_id'" == "" local task_id 1

di "Running task `task_id'"

Each array task should write a separate output file.

License courtesy

Stata MP licenses are shared. Do not leave interactive Stata sessions idle. Do not request more CPUs than set processors uses.

Checklist

  • [ ] Stata runs via stata-mp -b do, not interactively on the login node.
  • [ ] Logs are written to logs/.
  • [ ] STATATMP points to scratch and is cleaned up.
  • [ ] set processors matches SLURM_CPUS_PER_TASK.
  • [ ] Each array task writes separate output.
  • [ ] Idle Stata sessions are closed.

Further reading

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.