-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_and_store_predictions.fish
More file actions
executable file
·58 lines (50 loc) · 1.8 KB
/
Copy pathrun_and_store_predictions.fish
File metadata and controls
executable file
·58 lines (50 loc) · 1.8 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/fish
# NOTE: May only be run from the project root
if test -f "./run_and_store_predictions.fish"
echo "correct calling directory"
else
return -1
end
# set skip 0
# for current_to_analyse in (ls -1 user_recordings/ | tail -n (math 36 - $skip))
# NOTE: for each file in user_files:
for current_to_analyse in (ls -1 user_recordings/ )
# NOTE: Run cargo run, and collect results in `./predictions.csv` and `./ground_truth.csv`
# set -l current_to_analyse "standard_experienced-user_trial-1"
cargo run --release ./user_recordings/$current_to_analyse &>/dev/null &
set -l rust_pid $last_pid
trap "kill $rust_pid" EXIT
if kill -0 $rust_pid &>/dev/null
echo "Started new session on file $current_to_analyse with rust pid $rust_pid"
else
while true
echo "PID ($pid) NOT SUCCESFULLY SAVED"
sleep 1
end
end
# NOTE: Detect once running is done (idea, both predictions.csv and ground_truth.csv
# will be stable for > 5 second)
# give time for stuff to update
sleep 5
set file_time (stat -c %Y prediction.csv)
set actual_time (date +%s)
set diff (math "$actual_time - $file_time")
while test $diff -le 5
echo "Not finished yet, with time diff of $diff, at of $actual_time, and file_t of $file_time"
sleep 5
set file_time (stat -c %Y ./prediction.csv)
set actual_time (date +%s)
set diff (math "$actual_time - $file_time")
end
# NOTE: move both files to `./data_analysis/data/` with a corresponding name (use some string manip)
# mv ./prediction.csv ./data_analysis/6_temporal_frames_data/prediction_$current_to_analyse
mv ./ground_truth.csv ./data_analysis/recalculated_ground_truths/ground_truth_$current_to_analyse
# give some time for the moving
kill $rust_pid
while kill -0 $rust_pid &>/dev/null
echo "RUST IS STILL RUNNING"
sleep 1
end
sleep 3
# continue on for other files
end