#NEWLINE# def get_strings( app_json , required_file_input_names , optional_file_input_names , required_file_array_input_names , optional_file_array_input_names , file_output_names , dummy_output_hash ) : #NEWLINE# #INDENT# init_inputs_str = '' #NEWLINE# dl_files_str = '' #NEWLINE# ul_files_str = '' #NEWLINE# outputs_str = '' #NEWLINE# if ( ( 'inputSpec' in app_json ) and app_json [ 'inputSpec' ] ) : #NEWLINE# #INDENT# init_inputs_str = ( ( '\n' + '\n' . join ( [ '    echo "Value of {name}: \'${var}\'"' . format ( name = input_param [ 'name' ] , var = ( ( ( '{' + input_param [ 'name' ] ) + '[@]}' ) if input_param [ 'class' ] . startswith ( 'array:' ) else input_param [ 'name' ] ) ) for input_param in app_json [ 'inputSpec' ] ] ) ) + '\n' ) #NEWLINE# #UNINDENT# if ( required_file_input_names or optional_file_input_names or required_file_array_input_names or optional_file_array_input_names ) : #NEWLINE# #INDENT# dl_files_str = ( ( '\n' + fill ( 'The following line(s) use the dx command-line tool to download\nyour file inputs to the local file system using variable names for the filenames.\nTo recover the original filenames, you can use the output of "dx describe "$variable" --name".' , initial_indent = '    # ' , subsequent_indent = '    # ' , width = 80 ) ) + '\n\n' ) #NEWLINE# if required_file_input_names : #NEWLINE# #INDENT# dl_files_str += '\n' . join ( [ '    dx download "${name}" -o {name}\n' . format ( name = name ) for name in required_file_input_names ] ) #NEWLINE# #UNINDENT# if optional_file_input_names : #NEWLINE# #INDENT# dl_files_str += ( '\n' . join ( [ '    if [ -n "${name}" ]\n    then\n        dx download "${name}" -o {name}\n    fi' . format ( name = name ) for name in optional_file_input_names ] ) + '\n' ) #NEWLINE# #UNINDENT# if ( required_file_array_input_names or optional_file_array_input_names ) : #NEWLINE# #INDENT# dl_files_str += '\n' . join ( [ '    for i in ${{!{name}[@]}}\n    do\n        dx download "${{{name}[$i]}}" -o {name}-$i\n    done\n' . format ( name = name ) for name in ( required_file_array_input_names + required_file_array_input_names ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# if file_output_names : #NEWLINE# #INDENT# ul_files_str = ( '\n' if ( init_inputs_str != '' ) else '' ) #NEWLINE# ul_files_str += ( fill ( 'The following line(s) use the dx command-line tool to upload your file outputs after you have created them on the local file system.  It assumes that you have used the output field name for the filename for each output, but you can change that behavior to suit your needs.  Run "dx upload -h" to see more options to set metadata.' , initial_indent = '    # ' , subsequent_indent = '    # ' , width = 80 ) + '\n\n' ) #NEWLINE# ul_files_str += ( '\n' . join ( [ '    {name}=$(dx upload {name} --brief)' . format ( name = name ) for name in file_output_names ] ) + '\n' ) #NEWLINE# #UNINDENT# if ( ( 'outputSpec' in app_json ) and app_json [ 'outputSpec' ] ) : #NEWLINE# #INDENT# outputs_str = ( ( '\n' + fill ( 'The following line(s) use the utility dx-jobutil-add-output to format\nand add output variables to your job\'s output as appropriate for the output class.  Run\n"dx-jobutil-add-output -h" for more information on what it does.' , initial_indent = '    # ' , subsequent_indent = '    # ' , width = 80 ) ) + '\n\n' ) #NEWLINE# outputs_str += '\n' . join ( [ ( ( ( ( ( '    dx-jobutil-add-output ' + output_param [ 'name' ] ) + ' "$' ) + output_param [ 'name' ] ) + '" --class=' ) + output_param [ 'class' ] ) for output_param in app_json [ 'outputSpec' ] ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'outputSpec' not in app_json ) : #NEWLINE# #INDENT# outputs_str = ( '\n' + fill ( 'No output spec is specified, but\nif you would like to add output fields, you can add invocations of the\ndx-jobutil-add-output utility to format and add values to the\njob_output.json file.  For example, "dx-jobutil-add-output keyname 32"\nwill add an output field called "keyname" with value equal to the\nnumber 32.  Run "dx-jobutil-add-output -h" for more details on what\nit does.' , initial_indent = '    # ' , subsequent_indent = '    # ' , width = 80 ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ( '' , init_inputs_str , dl_files_str , ul_files_str , outputs_str )