Skip to content

Commit

Permalink
upload combined csv file after use
Browse files Browse the repository at this point in the history
  • Loading branch information
36000 committed Nov 10, 2020
1 parent 10af1ef commit 4957604
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/cloudknot_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,33 @@ def afq_combine_profiles(dummy_argument):
result_futures2 = knot2.map(["dummy_argument"], job_type="independent")
result_futures2.result()
knot2.clobber(clobber_pars=True, clobber_repo=True, clobber_image=True)

# When all jobs are finished, remember to clobber the knot
# either using the aws console or this function in jupyter notebook:
result_futures.result() # waits for futures to resolve, not needed in notebook
knot.clobber(clobber_pars=True, clobber_repo=True, clobber_image=True)

# we create another knot which downloads the resulting profiles of each subject,
# combines them into one csv file, and then uploads that csv file


def afq_combine_profiles(dummy_argument):
from AFQ.api import download_and_combine_afq_profiles
import s3fs

download_and_combine_afq_profiles(
"temp", "my_study_bucket", "my_study_prefix/derivatives/afq",
upload=s3fs.S3FileSystem())


knot2 = ck.Knot(
name='afq_combine_subjects-201009-0',
func=afq_combine_profiles,
base_image='python:3.8',
image_github_installs="https://github.com/yeatmanlab/pyAFQ.git",
pars_policies=('AmazonS3FullAccess',),
bid_percentage=100)

result_futures2 = knot2.map(["dummy_argument"], job_type="independent")
result_futures2.result()
knot2.clobber(clobber_pars=True, clobber_repo=True, clobber_image=True)

0 comments on commit 4957604

Please sign in to comment.