Previous changeset 13:b5f070767ed4 (2018-02-01) Next changeset 15:65b91cd687f8 (2018-02-01) |
Commit message:
Uploaded 20180201 |
modified:
query.py query.xml |
added:
._.shed.yml ._example.tsv ._query.py ._query.xml |
b |
diff -r b5f070767ed4 -r e780b47013df ._.shed.yml |
b |
Binary file ._.shed.yml has changed |
b |
diff -r b5f070767ed4 -r e780b47013df ._example.tsv |
b |
Binary file ._example.tsv has changed |
b |
diff -r b5f070767ed4 -r e780b47013df ._query.py |
b |
Binary file ._query.py has changed |
b |
diff -r b5f070767ed4 -r e780b47013df ._query.xml |
b |
Binary file ._query.xml has changed |
b |
diff -r b5f070767ed4 -r e780b47013df query.py --- a/query.py Thu Feb 01 16:23:26 2018 -0500 +++ b/query.py Thu Feb 01 17:13:30 2018 -0500 |
[ |
@@ -18,9 +18,12 @@ __version__ = "1.0.0"; VALID_CHARS = '.-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ' +# in the case of collections, exitcodes equal to 0 and 1 are not considered errors +ERR_EXIT_CODE = 2; +OK_EXIT_CODE = 0; -# in the case of collections, exitcodes equal to 0 and 1 are not considered errors -def raiseException( exitcode, message, errorfilepath ): +def raiseException( exitcode, message, output_dir_path, errorfilename ): + errorfilepath = os.path.join(output_dir_path, errorfilename+"_txt"); with open(errorfilepath, 'w') as out: out.write(message); sys.exit(exitcode); @@ -66,7 +69,7 @@ task_processed = True; break; elif json_status_content['state'] in ['FAILURE', 'REVOKED']: - return raiseException( 1, "Task ID: "+str(task_id)+"\nTask status: "+str(json_status_content['state']), str(options.errorfile) ); + return raiseException( ERR_EXIT_CODE, "Task ID: "+str(task_id)+"\nTask status: "+str(json_status_content['state']), output_dir_path, str(options.errorfile) ); else: time.sleep(QUERY_DELAY); # in seconds @@ -81,9 +84,9 @@ accessions_list = accessions_list + accession_number + "\n"; with open(output_file_path, 'w') as out: out.write(accessions_list.strip()); - return sys.exit(0); + return sys.exit(OK_EXIT_CODE); else: - return raiseException( 1, "Unable to query the remote server. Please try again in a while.", str(options.errorfile) ); + return raiseException( ERR_EXIT_CODE, "Unable to query the remote server. Please try again in a while.", output_dir_path, str(options.errorfile) ); def query( options, args ): output_dir_path = options.outputdir; @@ -110,13 +113,13 @@ seq_id = ''.join(e for e in seq_id if e in VALID_CHARS) seq_text = line_split[1]; if seq_id in multiple_data: - return raiseException( 1, "Error: the id '"+seq_id+"' is duplicated", str(options.errorfile) ); + return raiseException( ERR_EXIT_CODE, "Error: the id '"+seq_id+"' is duplicated", output_dir_path, str(options.errorfile) ); multiple_data[seq_id] = seq_text; if len(multiple_data) > 0: return query_request( options, args, multiple_data ); #return echo( options, args ); else: - return raiseException( 1, "An error has occurred. Please be sure that your input files are valid.", str(options.errorfile) ); + return raiseException( ERR_EXIT_CODE, "An error has occurred. Please be sure that your input files are valid.", output_dir_path, str(options.errorfile) ); else: # try with the sequence in --sequence text_content = options.sequences; @@ -136,16 +139,16 @@ seq_id = ''.join(e for e in seq_id if e in VALID_CHARS) seq_text = line_split[1]; if seq_id in multiple_data: - return raiseException( 1, "Error: the id '"+seq_id+"' is duplicated", str(options.errorfile) ); + return raiseException( ERR_EXIT_CODE, "Error: the id '"+seq_id+"' is duplicated", output_dir_path, str(options.errorfile) ); multiple_data[seq_id] = seq_text; if len(multiple_data) > 0: return query_request( options, args, multiple_data ); #return echo( options, args ); else: - return raiseException( 1, "An error has occurred. Please be sure that your input files are valid.", str(options.errorfile) ); + return raiseException( ERR_EXIT_CODE, "An error has occurred. Please be sure that your input files are valid.", output_dir_path, str(options.errorfile) ); else: - return raiseException( 1, "You have to insert at least one row formatted as a tab delimited (ID, SEQUENCE) couple", str(options.errorfile) ); - return 1; + return raiseException( ERR_EXIT_CODE, "You have to insert at least one row formatted as a tab delimited (ID, SEQUENCE) couple", output_dir_path, str(options.errorfile) ); + return ERR_EXIT_CODE; def __main__(): # Parse the command line options |
b |
diff -r b5f070767ed4 -r e780b47013df query.xml --- a/query.xml Thu Feb 01 16:23:26 2018 -0500 +++ b/query.xml Thu Feb 01 17:13:30 2018 -0500 |
b |
@@ -1,5 +1,5 @@ <?xml version="1.0"?> -<tool name="Query" id="sbtas_se_query" version="1.0.0"> +<tool name="Query" id="sbtas_se_query" version="1.0.0" profile="18.01"> <description>the AllSome Sequence Bloom Tree</description> <requirements> <requirement type="package" version="2.7.10">python</requirement> @@ -25,6 +25,7 @@ #end if --outputdir 'collection_content' + --errorfile 'Error Log File' ]]> </command> <inputs> |