-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from oesteban/agave
Agave app description generator
- Loading branch information
Showing
7 changed files
with
183 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
# @Author: oesteban | ||
# @Date: 2015-10-21 11:58:53 | ||
# @Last Modified by: oesteban | ||
# @Last Modified time: 2015-11-13 10:00:55 | ||
|
||
OUTPUT_FOLDER=$SCRATCH/${AGAVE_JOB_NAME}-${AGAVE_JOB_ID} | ||
# Create output folder in scratch | ||
mkdir -p ${OUTPUT_FOLDER} | ||
|
||
echo "Running mriqc on ${bidsFile}" >> ${OUTPUT_FOLDER}/${AGAVE_JOB_NAME}.out | ||
|
||
# Activate anaconda env | ||
source activate crn-2.7 | ||
|
||
# Call mriqcp | ||
FSLOUTPUTTYPE='NIFTI_GZ' mriqc -i ${bidsFile} -o ${OUTPUT_FOLDER}/out -w ${OUTPUT_FOLDER}/tmp 2>> ${OUTPUT_FOLDER}/${AGAVE_JOB_NAME}.err 1>> ${OUTPUT_FOLDER}/${AGAVE_JOB_NAME}.out | ||
|
||
# Collect outputs | ||
archivepath=$(echo ${OUTPUT_FOLDER}/out | cut -d: -f2 | xargs) | ||
ln -s $archivepath . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "mriqc-docker", | ||
"version": "0.1.0", | ||
"helpURI": "http://mriqc.readthedocs.org", | ||
"label": "The MRIQC workflow in docker", | ||
"defaultNodeCount": 1, | ||
"defaultRequestedTime": "48:00:00", | ||
"shortDescription": "Run CRN's workflows in Agave's Dockerized cloud.", | ||
"longDescription": "Generic template for running an arbitrary application in Agave's hosted Docker cloud. Apps should be a gzipped archive.", | ||
"executionSystem": "docker.tacc.utexas.edu", | ||
"executionType": "CLI", | ||
"parallelism": "SERIAL", | ||
"deploymentPath": "apps/mriqc-docker", | ||
"deploymentSystem": "openfmri-storage", | ||
"templatePath": "wrapper.sh", | ||
"testPath": "test/test.sh", | ||
"tags": [ | ||
"docker", "qc", "preprocessing" | ||
], | ||
"modules": [], | ||
"inputs": [ | ||
{ | ||
"id": "bidsFolder", | ||
"details": { | ||
"label": "folder", | ||
"description": "input folder, should be BIDS compliant", | ||
"argument": null, | ||
"showArgument": false | ||
}, | ||
"value": { | ||
"visible": true, | ||
"required": true, | ||
"type": "string", | ||
"default": "agave://openfmri-storage/ds003_downsampled.tar" | ||
}, | ||
"semantics": { | ||
"ontology": [] | ||
} | ||
} | ||
], | ||
"parameters": [], | ||
"checkpointable": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -x | ||
export AGAVE_JOB_ID="test123345" | ||
export AGAVE_JOB_NAME="testuser-runner" | ||
export AGAVE_JOB_CALLBACK_FAILURE="" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#set -x | ||
|
||
echo "Running mriqc-docker on ${bidsFolder}" >> ${AGAVE_JOB_NAME}.out | ||
|
||
# Run the container in docker, mounting the current job directory as /scratch in the container | ||
# Note that here the docker container image must exist for the container to run. If it was | ||
# not built using a passed in Dockerfile, then it will be downloaded here prior to | ||
# invocation. Also note that all output is written to the mounted directory. This allows | ||
# Agave to stage out the data after running. | ||
|
||
docker run -i --rm -v `pwd`:/scratch -w /scratch oesteban/mriqc -i ${bidsFolder} -o outputs -w workdir 2>> ${AGAVE_JOB_NAME}.err 1>> ${AGAVE_JOB_NAME}.out | ||
|
||
if [ ! $? ]; then | ||
echo "Docker process exited with an error status." >&2 | ||
${AGAVE_JOB_CALLBACK_FAILURE} | ||
exit | ||
fi | ||
|
||
# Good practice would suggest that you clean up your image after running. For throughput | ||
# you may want to leave it in place. iPlant's docker servers will clean up after themselves | ||
# using a purge policy based on size, demand, and utilization. | ||
|
||
#sudo docker rmi $DOCKER_IMAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# @Author: oesteban | ||
# @Date: 2016-03-16 11:28:27 | ||
# @Last Modified by: oesteban | ||
# @Last Modified time: 2016-03-16 15:12:13 | ||
|
||
""" | ||
Agave app generator | ||
""" | ||
import json | ||
from argparse import ArgumentParser, RawTextHelpFormatter | ||
import mriqc | ||
|
||
agaveapp = { | ||
'name': mriqc.__name__, | ||
'version': mriqc.__versionbase__, | ||
'helpURI': 'http://mriqc.readthedocs.org', | ||
'label': 'mriqc', | ||
'shortDescription': mriqc.__description__, | ||
'longDescription': mriqc.__longdesc__, | ||
'executionSystem': 'slurm-ls5.tacc.utexas.edu', | ||
'executionType': 'HPC', | ||
'parallelism': 'PARALLEL', | ||
'defaultQueue': 'normal', | ||
'defaultNodeCount': 1, | ||
'deploymentPath': 'apps/mriqc', | ||
'deploymentSystem': 'openfmri-storage', | ||
'templatePath': 'wrapper.sh', | ||
'testPath': 'test/test.sh', | ||
'tags': ['qc', 'sMRI', 'fMRI'], | ||
'modules': [], | ||
'inputs': [{ | ||
'id': 'bidsFolder', | ||
'details': { | ||
'label': 'folder', | ||
'description': 'input root folder of a BIDS-compliant tree', | ||
'argument': None, | ||
'showArgument': False | ||
}, | ||
'value': { | ||
'visible': True, | ||
'required': True, | ||
'type': 'string', | ||
'default': 'agave://openfmri-storage/data/ds003_downsampled' | ||
}, | ||
'semantics': { | ||
'ontology': [] | ||
} | ||
}], | ||
'parameters': [], | ||
'checkpointable': False | ||
} | ||
|
||
def main(): | ||
"""Entry point""" | ||
|
||
parser = ArgumentParser(description='ABIDE2BIDS downloader', | ||
formatter_class=RawTextHelpFormatter) | ||
g_inputs = parser.add_argument_group('Inputs') | ||
g_inputs.add_argument('--help-uri', action='store') | ||
g_inputs.add_argument('--input-name', action='store') | ||
g_inputs.add_argument('-E', '--exec-system', action='store') | ||
|
||
|
||
g_outputs = parser.add_argument_group('Outputs') | ||
g_outputs.add_argument('-o', '--output', action='store', | ||
default='app.json') | ||
|
||
opts = parser.parse_args() | ||
|
||
if opts.input_name is not None: | ||
agaveapp['inputs'][0]['id'] = opts.input_name | ||
if opts.exec_system: | ||
agaveapp['executionSystem'] = opts.exec_system | ||
|
||
with open(opts.output, 'w') as appfile: | ||
json.dump(agaveapp, appfile, indent=4) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
main() |