File size: 937 Bytes
c8420ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Kernel cell (piped to `colab exec`): waits for the detached ImageNet preparation (data5.py val,train) to finish, then
# runs run_pilot_cell.py's logic (pilot.py skips the depth units already marked done on Drive). Keeps the kernel busy.
import subprocess
import time

PREP_LOG = "/content/set5/logs/inet_prep.log"


def prep_running():
    return subprocess.run(["pgrep", "-f", "data5.py val,train"], capture_output=True).returncode == 0


while prep_running():
    last = subprocess.run(f"tail -n 1 {PREP_LOG}", shell=True, capture_output=True, text=True).stdout.strip()
    print(time.strftime("%H:%M:%S"), "[prep]", last[:160], flush=True)
    time.sleep(60)
print(time.strftime("%H:%M:%S"), "prep ended:", subprocess.run(f"tail -n 3 {PREP_LOG}", shell=True, capture_output=True,
                                                               text=True).stdout, flush=True)
exec(open("/content/set5/code/run_pilot_cell.py").read())