Last active
July 22, 2016 14:21
-
-
Save mlin/3cce81f54a640c3f62a2725acbc98283 to your computer and use it in GitHub Desktop.
dxapp.yml
This file contains hidden or 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
#!/usr/bin/env python | |
# | |
# dx-yml-build: transcodes dxapp.yml to dxapp.json and then runs `dx build` | |
# with command-line arguments passed through. | |
# | |
# Requires PyYAML (apt-get install python-yaml OR pip install pyyaml) | |
import os, sys | |
import yaml, json | |
with open('dxapp.yml') as infile: | |
data = yaml.load(infile) | |
data["00COMMENT"] = "This dxapp.json has been generated from dxapp.yml automatically using dx-yml-build" | |
with open('dxapp.json', 'w') as outfile: | |
json.dump(data, outfile, sort_keys=True, indent=2) | |
outfile.write('\n') | |
os.execvp("dx", ["dx", "build"] + sys.argv[1:]) |
This file contains hidden or 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
name: hello-world | |
dxapi: 1.0.0 | |
version: 0.0.1 | |
inputSpec: | |
- name: infile | |
class: file | |
optional: true | |
outputSpec: | |
- name: outfile | |
class: file | |
runSpec: | |
systemRequirements: | |
main: | |
instanceType: mem1_ssd1_x2 | |
distribution: Ubuntu | |
release: "14.04" | |
execDepends: | |
- name: liblz4-tool | |
interpreter: bash | |
code: | | |
#!/bin/bash | |
main() { | |
set -ex -o pipefail | |
# dx-download-all-inputs --parallel | |
if [ -n "$infile" ]; then | |
dx cat "$infile" > /dev/null | |
fi | |
mkdir -p out/outfile | |
echo "Hello, world!" > out/outfile/hello-world.txt | |
# dx-upload-all-outputs --parallel | |
outfile=$(cat out/outfile/hello-world.txt | dx upload --destination "hello-world.txt" --brief -) | |
dx-jobutil-add-output outfile "$outfile" --class=file | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment