File size: 1,176 Bytes
2e7f744
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Turn data/v3/full/tasks into Apptainer tasks for Harbor's singularity backend, split into 3 shards (one per
Claude Code token). Only the harness files change: environment/Dockerfile is dropped (the SIF already holds the
runtime; Harbor uploads environment/ to /app) and task.toml's [environment] points at the SIF. instruction.md,
context/, tests/ and solution/ are copied unchanged.

python -I v3/della/make_sif_tasks.py   -> tasks/prophet-v3-sif/shard{1,2,3}/<task_id>/
"""
import os, shutil
R = '/scratch/gpfs/TRIDAO/ly3223/oraclebench/'
SRC, DST = R + 'data/v3/full/tasks/', R + 'tasks/prophet-v3-sif/'
ENV_SIF = '''[environment]
docker_image = "%simages/fcs2-forecast-base.sif"
network_mode = "public"
os = "linux"
cpus = 1
memory_mb = 2048
''' % R
shutil.rmtree(DST, ignore_errors=True)
ids = sorted(os.listdir(SRC))
for i, tid in enumerate(ids):
    d = DST + f'shard{i % 3 + 1}/' + tid
    shutil.copytree(SRC + tid, d, ignore=shutil.ignore_patterns('Dockerfile'))
    p = d + '/task.toml'
    s = open(p).read()
    open(p, 'w').write(s[:s.index('[environment]')] + ENV_SIF)
print({k: len(os.listdir(DST + k)) for k in sorted(os.listdir(DST))}, 'total', len(ids))