Skip to content

Commit 2833b61

Browse files
committed
start testing yml
1 parent 54d6788 commit 2833b61

File tree

9 files changed

+129
-12
lines changed

9 files changed

+129
-12
lines changed

.github/workflows/main.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: act-workflow
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- dev
7+
schedule:
8+
- cron: "0 0 * * *"
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
packages: write
14+
issues: write
15+
id-token: write
16+
pages: write
17+
18+
jobs:
19+
install-reqs-n-run-scripts:
20+
name: install-py-reqs
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: set up python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: "3.9"
31+
32+
- name: install pyreqs
33+
run: pip install -r requirements.txt
34+
35+
name: install-r-reqs
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: set up R
40+
uses: r-lib/actions/setup-r@v2
41+
42+
- name: install rreqs
43+
run: Rscript ./R_requirements.R
44+
45+
46+
name: run orchestrator
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: run orchestrator
51+
run: current_date=$(date +"%Y-%m-%d")\
52+
python3 ./code/orchestrate.py -i '/Volumes/VossLab/Repositories/Accelerometer_Data/' -token 'DE4E2DB72778DACA9B8848574107D2F5P' | tee > ./out/log-{}.txt'
53+
54+
- name: checkout code
55+
uses: actions/checkout@v4
56+
57+

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ This repo contains a minimal amount of hard-coding to allow for reproducibility
1414
- [x] GGIR is formatted as GGIR-#.# with no more version numbers after the second. Full version number should be put into the readme
1515
- [x] Finish adding all required code to move to linux
1616
- [x] move to linux?
17-
- [ ] Test on linux and prepare prelims
17+
- [ ] screw linux let's move to github actions
18+
- [x] complete yml files
19+
- [ ] test yml
20+

R_requirements.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
install.packages("GGIR", dependenceies = TRUE)
2+
library(GGIR)

code/orchestrate.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def init_servers():
3838
except Exception as e:
3939
print(f'An error occured trying to connect to RDSS: {e}')
4040
sys.exit(1)
41+
42+
print("""
43+
Server check passed -> checking rdss files
44+
*----------------------------*
45+
""")
4146
return None
4247

4348
def check_files():
@@ -47,6 +52,7 @@ def check_files():
4752

4853
if len(rdss_files) == 0:
4954
print("error: RDSS files were not grabbed - find out why")
55+
sys.exit(1)
5056

5157
need = compare(rdss_files, TXT)
5258

@@ -62,7 +68,10 @@ def create_comparable_dataframe(need):
6268
from src.match import parse_files
6369

6470
if type(need) != list:
65-
print("need is not a list... you need to figure out why")
71+
print("""
72+
need is not a list... you need to figure out why
73+
*----------------------------*
74+
""")
6675
exit()
6776

6877
lab_id_file = parse_files(need)
@@ -81,7 +90,10 @@ def create_comparable_dataframe(need):
8190
print(error)
8291
sys.exit(1)
8392
else:
84-
print("All rows are valid")
93+
print("""
94+
All rows are valid
95+
*----------------------------*
96+
""")
8597

8698
return lab_id_file
8799

@@ -111,6 +123,7 @@ def GGIR(outs):
111123
#this is where we run GGIR using the GGIR function in matched
112124
from src.match import GGIR
113125
GGIR(outs)
126+
print("GGIR completed -> moving to validation")
114127
return None
115128

116129

@@ -131,7 +144,7 @@ def main():
131144

132145
return None
133146

134-
if __name__ == 'main':
147+
if __name__ == '__main__':
135148
main()
136149

137150

code/src/accel.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,4 +411,4 @@ re_run_intensity_gradient <- function(r, project_dir, project_deriv_dir, verbose
411411
}
412412

413413
# Run the main function
414-
main(opt)
414+
main(opt)

code/src/clean_gg_outs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def rename_dirs(list, dir):
4343
# Rename the directory
4444
print('Renaming', os.path.join(dir, d), final)
4545
os.rename(os.path.join(dir, d), final)
46-
46+
4747
return renamed_dirs
4848

4949
def structure_dirs(list, dir):
@@ -61,14 +61,14 @@ def structure_dirs(list, dir):
6161
# move the renamed directory to the new subject directory
6262
print('Moving', d, new_sub)
6363
shutil.move(d, new_sub)
64-
64+
return None
6565

6666

6767

6868
def main():
6969
arg = args()
7070
dirs = gather_dirs(arg.dir)
7171
structure_dirs(rename_dirs(dirs, arg.dir), arg.dir)
72-
72+
7373
if __name__ == '__main__':
74-
main()
74+
main()

code/src/match.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def compare_ids(files, list):
9191
how='inner',
9292
validate='many_to_one'
9393
)
94-
94+
9595
# Rename columns to match the desired output
9696
matched = matched[['lab_id', 'file', 'boost_id']].rename(columns={'file': 'raw_file', 'boost_id': 'subject_id'})
9797

@@ -194,7 +194,9 @@ def save_n_rename_files(matched, dir):
194194
src = os.path.join(dir, row['raw_file'])
195195
dest = os.path.join(output_dir, f"sub-{row['subject_id']}_{row['session']}.csv")
196196

197-
print('source: ', src, ' ', 'destination: ', dest)
197+
198+
199+
print('source: ', src, ' ', 'destination: ', dest)
198200

199201
# Copy the file to the destination
200202
#shutil.copy(src, dest)

code/src/val-run.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
import sys
3+
import requests
4+
5+
6+
OUTDIR = '/Volumes/vosslabhpc/Projects/Boost/path/to/out'
7+
8+
9+
def parse_args():
10+
from argparse import ArgumentParser
11+
args = ArgumentParser(description='validates a run from an input text output')
12+
args.add_argument('-i', type=str, required=True, help='input txt file from most recent GGIR pipeline out')
13+
14+
15+
return args.parse_args()
16+
17+
def create_obj(filepath):
18+
# creates a parseable text object from a text file -> used to validate run of pipeline post-compute
19+
dic = {}
20+
with open(filepath, 'r') as f:
21+
for line in f:
22+
23+
return None
24+
25+
26+
def main():
27+
args = parse_args()
28+
in = args.i
29+
30+
31+
32+
return None
33+
34+
35+
36+
37+
38+
39+
if __name__ == '__main__':
40+
main()

dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN pip install --no-cache-dir -r requirements.txt
2424
COPY R_requirements.R /app/
2525

2626
# Install R dependencies
27-
RUN python3 code/orchestrate.py -token {INSERT TOKEN HERE}
27+
RUN python3 code/orchestrate.py -i = -token {INSERT TOKEN HERE}
2828
# Copy the rest of the application code into the image
2929
COPY . /app/
3030

0 commit comments

Comments
 (0)