Skip to content

Commit

Permalink
PTFM-17932 remove remaining gtable from app wizard
Browse files Browse the repository at this point in the history
Summary:
In an effort to move away from gtables, remove the remaining gtable code
from dx-app-wizard.

Test Plan: existing tests

Reviewers: pnguyen

Reviewed By: pnguyen

Differential Revision: https://dnanexus.phacility.com/D934
  • Loading branch information
JoeSachmo committed May 13, 2016
1 parent 6ea02d5 commit 41b1b21
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 317 deletions.
4 changes: 3 additions & 1 deletion .arclint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"pep8": {
"type": "pep8",
"include": "(\\.py$)",
"exclude": "(^src/python/dxpy/templating/templates/python/)",
"flags": ["--max-line-length=119"],
"severity.rules": {
"(^E)": "warning",
Expand All @@ -11,7 +12,8 @@
},
"pyflakes": {
"type": "pyflakes",
"include": "(\\.py$)"
"include": "(\\.py$)",
"exclude": "(^src/python/dxpy/templating/templates/python/)"
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def main(DX_APP_WIZARD_INPUT_SIGNATURE):
# return { "app_output_field": postprocess_job.get_output_ref("answer"), ...}
#
# Tip: you can include in your output at this point any open
# objects (such as gtables) which will be closed by a job that
# objects (such as files) which will be closed by a job that
# finishes later. The system will check to make sure that the
# output object is closed and will attempt to clone it out as
# output into the parent container only after all subjobs have
Expand Down
20 changes: 0 additions & 20 deletions src/python/dxpy/templating/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,26 +197,6 @@ def get_pattern(template_dir):
use_completer()
return pattern

def get_parallelized_io(required_file_input_names, gtable_input_names, gtable_output_names):
input_field = ''
output_field = ''

if required_file_input_names or gtable_input_names:
print('')
print(fill('Your app template can be initialized to split and process a ' + BOLD() + 'GTable' + ENDC() + ' input. The following of your input fields are eligible for this template pattern:'))
print(' ' + '\n '.join(gtable_input_names))
use_completer(Completer(gtable_input_names))
input_field = prompt_for_var('Input field to process (press ENTER to skip)', '', choices=required_file_input_names + gtable_input_names)
use_completer()

if input_field != '' and len(gtable_output_names) > 0:
print('')
print(fill('Your app template can be initialized to build a ' + BOLD() + 'GTable' + ENDC() + ' in parallel for your output. The following of your output fields are eligible for this template pattern:'))
print(' ' + '\n '.join(gtable_output_names))
use_completer(Completer(gtable_output_names))
output_field = prompt_for_var('Output gtable to build in parallel (press ENTER to skip)', '', choices=gtable_output_names)
return input_field, output_field

def fill_in_name_and_ver(template_string, name, version):
'''
TODO: Rename this?
Expand Down
25 changes: 2 additions & 23 deletions src/python/scripts/dx-app-wizard
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ from collections import OrderedDict
import dxpy
from dxpy.templating.utils import (print_intro, get_name, get_version, get_metadata, Completer, get_ordinal_str,
prompt_for_var, prompt_for_yn, use_completer, get_language, language_options,
get_pattern, get_parallelized_io, fill_in_name_and_ver, clean,
create_files_from_templates)
get_pattern, fill_in_name_and_ver, clean, create_files_from_templates)
from dxpy.utils.printing import fill, BOLD, UNDERLINE, DNANEXUS_LOGO, ENDC
from dxpy.app_categories import APP_CATEGORIES
from dxpy.utils.completer import InstanceTypesCompleter
Expand Down Expand Up @@ -256,8 +255,6 @@ optional_file_input_names = []
required_file_array_input_names = []
optional_file_array_input_names = []
file_output_names = []
gtable_input_names = []
gtable_output_names = []

if 'inputSpec' in app_json:
for param in app_json['inputSpec']:
Expand All @@ -266,16 +263,13 @@ if 'inputSpec' in app_json:
param_list = optional_file_input_names if may_be_missing else required_file_input_names
elif param['class'] == 'array:file':
param_list = optional_file_array_input_names if may_be_missing else required_file_array_input_names
elif param['class'] == 'gtable':
param_list = gtable_input_names
else:
param_list = None
if param_list is not None:
param_list.append(param['name'])

if 'outputSpec' in app_json:
file_output_names = [param['name'] for param in app_json['outputSpec'] if param['class'] == 'file']
gtable_output_names = [param['name'] for param in app_json['outputSpec'] if param['class'] == 'gtable']

########################
# LANGUAGE AND PATTERN #
Expand All @@ -297,19 +291,6 @@ template_dir = os.path.join(os.path.dirname(dxpy.__file__), 'templating', 'templ
pattern = get_pattern(template_dir)
template_dir = os.path.join(template_dir, pattern)

pattern_suffix = ''
parallelized_input_field = ''
parallelized_output_field = ''
if pattern == 'parallelized' and len([filename for filename in os.listdir(os.path.join(template_dir, 'src')) if filename.startswith('code-')]) > 0:
parallelized_input_field, parallelized_output_field = get_parallelized_io(required_file_input_names,
gtable_input_names,
gtable_output_names)
pattern_suffix = ''
if parallelized_input_field != '':
pattern_suffix += '-input-gtable'
if parallelized_output_field != '':
pattern_suffix += '-output-gtable'

with open(os.path.join(template_dir, 'dxapp.json'), 'r') as template_app_json_file:
file_text = fill_in_name_and_ver(template_app_json_file.read(), name, version)
template_app_json = json.loads(file_text)
Expand Down Expand Up @@ -423,9 +404,7 @@ elif pattern == 'scatter-process-gather':
manifest += create_files_from_templates(template_dir, app_json, language,
required_file_input_names, optional_file_input_names,
required_file_array_input_names, optional_file_array_input_names,
file_output_names,
pattern, pattern_suffix,
parallelized_input_field, parallelized_output_field,
file_output_names, pattern,
entry_points=entry_points, description=description)

print("Created files:")
Expand Down

0 comments on commit 41b1b21

Please sign in to comment.