Index of every page on this site: llms.txt
All skills
victory-hugo avatar

/bioinformatics-log-resume

@0b19307
Run it yourself

为生物信息学多样本批处理脚本设计、实现或审查基于日志的断点续跑。用于 bash/shell 主控脚本需要支持中断后重跑、并行写日志防竞争、按样本写入 success.log 和 fail.log、并且明确禁止通过扫描输出目录或输出文件判断完成状态的场景。适用于给现有流水线补加断点续跑、重构样本循环、或检查实现是否只依赖日志判定完成。

  • 3 files
  • 6.5 KB
  • Updated 8 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/victory-hugo/s2-agent-skill/bioinformatics-log-resume

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesshell-patterns.md

≈402 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Shell Patterns

Initialize Logs

LOG_DIR="${PROJECT_DIR}/log"
LOCK_FILE="${LOG_DIR}/.resume.lock"
SUCCESS_LOG="${LOG_DIR}/success.log"
FAIL_LOG="${LOG_DIR}/fail.log"

mkdir -p "$LOG_DIR"
touch "$LOCK_FILE" "$SUCCESS_LOG" "$FAIL_LOG"

Load Completed Samples

只读取 success.log 第一列:

declare -A COMPLETED=()

while IFS=$'\t' read -r sample_id _; do
  [ -n "$sample_id" ] || continue
  COMPLETED["$sample_id"]=1
done < "$SUCCESS_LOG"

Skip Check

使用精确样本 ID 匹配,不做模糊匹配:

is_completed() {
  local sample_id="$1"
  [[ -n "${COMPLETED[$sample_id]:-}" ]]
}

Locked Append

record_success() {
  local sample_id="$1"
  local ts
  ts="$(date -Iseconds)"
  flock "$LOCK_FILE" bash -c 'printf "%s\t%s\n" "$1" "$2" >> "$3"' _ \
    "$sample_id" "$ts" "$SUCCESS_LOG"
  COMPLETED["$sample_id"]=1
}

record_fail() {
  local sample_id="$1"
  flock "$LOCK_FILE" bash -c 'printf "%s\n" "$1" >> "$2"' _ \
    "$sample_id" "$FAIL_LOG"
}

Per-Sample Worker Skeleton

run_one_sample() {
  local sample_id="$1"

  if is_completed "$sample_id"; then
    printf "[skip] %s already in success.log\n" "$sample_id" >&2
    return 0
  fi

  if run_sample_pipeline "$sample_id"; then
    record_success "$sample_id"
  else
    record_fail "$sample_id"
  fi
}

Anti-Examples

以下写法是禁止的,因为它依赖输出文件而不是日志:

if [ -s "${OUTPUT_DIR}/${sample_id}/result.tsv" ]; then
  echo "[skip] ${sample_id} finished before"
  continue
fi

应改为只查询 success.log。

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 0b19307. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 8 months ago

README badge

README badge for victory-hugo/s2-agent-skill/bioinformatics-log-resume