def submit_nsg(self, simjob, validate_only, server): nsg_template_param_file = "param.properties" nsg_template_input_file = "input.properties" return_filename = simjob.sim_name + '-nsg-return' simjob.append_log("Creating NSG parameter files: " + nsg_template_param_file + "," + nsg_template_input_file) #generate new properties with open( os.path.join(simjob.sim_directory_object.sim_results_dir, simjob.job_directory, nsg_template_input_file), 'w') as the_file: the_file.write('{}={}\n'.format( "infile_", os.path.join(simjob.job_directory, simjob.file_snapshotzip))) with open( os.path.join(simjob.sim_directory_object.sim_results_dir, simjob.job_directory, nsg_template_param_file), 'w') as the_file: the_file.write('{}={}\n'.format("toolId", simjob.server_nsg_tool)) the_file.write('{}={}\n'.format("filename_", simjob.batch_file)) the_file.write('{}={}\n'.format("number_nodes_", simjob.server_nodes)) the_file.write('{}={}\n'.format("number_cores_", simjob.server_cores)) the_file.write('{}={}\n'.format("pythonoption_", simjob.server_nsg_python)) the_file.write('{}={}\n'.format("outputfilename_", return_filename)) the_file.write('{}={}\n'.format("runtime_", simjob.server_max_runtime)) the_file.write('{}={}\n'.format("singlelayer_", "0")) #validate simjob.file_resultszip = return_filename + ".tar.gz" simjob.dir_results = return_filename simjob.write_properties() nsg = Client(server.nsg_api_appname, server.nsg_api_appid, server.user, server.password, server.nsg_api_url) simjob.append_log("Validating job build with NSG...") try: status = nsg.validateJobTemplate(simjob.job_directory_absolute) if status.isError(): simjob.append_log("NSG template validation failed. See debug.") else: simjob.append_log("NSG template validation success") except CipresError as e: simjob.append_log("Error validating NSG template: " + e.message) simjob.append_log("Job stopped") simjob.status = ServerInterface.nsg_status[3] simjob.write_properties() return if (validate_only): return try: sm = 'false' if simjob.server_status_email: sm = 'true' status = nsg.submitJobTemplate(simjob.job_directory_absolute, metadata={"statusEmail": sm}) simjob.server_remote_identifier = status.jobUrl simjob.write_properties() if status.isError(): simjob.append_log("NSG template submit failed. See debug.") else: simjob.append_log("NSG template submit success") simjob.status = ServerInterface.nsg_status[0] simjob.write_properties() except CipresError as e: simjob.append_log("Error submitting NSG template: " + e.message) simjob.append_log("Job stopped") return
def submit_nsg(self, simjob, validate_only, server): nsg_template_param_file = "param.properties" nsg_template_input_file = "input.properties" return_filename = simjob.sim_name + '-nsg-return' simjob.append_log("Creating NSG parameter files: " + nsg_template_param_file + "," + nsg_template_input_file) #generate new properties with open( os.path.join(simjob.sim_directory_object.sim_results_dir, simjob.job_directory, nsg_template_input_file), 'w') as the_file: the_file.write('{}={}\n'.format( "infile_", os.path.join(simjob.job_directory, simjob.file_snapshotzip))) with open( os.path.join(simjob.sim_directory_object.sim_results_dir, simjob.job_directory, nsg_template_param_file), 'w') as the_file: the_file.write('{}={}\n'.format("filename_", simjob.batch_file)) the_file.write('{}={}\n'.format("runtime_", simjob.server_max_runtime)) the_file.write('{}={}\n'.format("outputfilename_", return_filename)) if (simjob.server_nsg_tool in [ "NEURON77_TG", "NEURON75_TG", "NEURON74_TG", "NEURON73_TG", "EEGLAB_TG" ]): the_file.write('{}={}\n'.format("toolId", simjob.server_nsg_tool)) if (simjob.server_nsg_tool in [ "NEURON77_TG", "NEURON75_TG", "NEURON74_TG", "NEURON73_TG", "PY_TG_2.7.9", "PY_TG_3.5.0" ]): the_file.write('{}={}\n'.format("number_nodes_", simjob.server_nodes)) the_file.write('{}={}\n'.format("number_cores_", simjob.server_cores)) if (simjob.server_nsg_tool in [ "NEURON77_TG", "NEURON75_TG", "NEURON74_TG", "NEURON73_TG" ]): the_file.write('{}={}\n'.format("pythonoption_", simjob.server_nsg_python)) the_file.write('{}={}\n'.format("singlelayer_", "0")) if (simjob.server_nsg_tool in ["PY_TG_2.7.9", "PY_TG_3.5.0"]): the_file.write( '{}={}\n'.format("nrnivmodl_o_", "1") ) #Just assume we'll need neuron at some point. TODO: Add button to turn off the_file.write( '{}={}\n'.format("toolId", "PY_TG") ) #Our naming is just for convenience, nsg uses different names and a version if (simjob.server_nsg_tool in ["PY_TG_2.7.9"]): the_file.write('{}={}\n'.format("version_", "2.7.9")) else: the_file.write('{}={}\n'.format("version_", "3.5.0")) #validate simjob.file_resultszip = return_filename + ".tar.gz" simjob.dir_results = return_filename simjob.write_properties() nsg = Client(server.nsg_api_appname, server.nsg_api_appid, server.user, server.password, server.nsg_api_url) simjob.append_log("Validating job build with NSG...") try: status = nsg.validateJobTemplate(simjob.job_directory_absolute) if status.isError(): simjob.append_log("NSG template validation failed. See debug.") else: simjob.append_log("NSG template validation success") except CipresError as e: simjob.append_log("Error validating NSG template: " + e.message) simjob.append_log("Job stopped") simjob.status = ServerInterface.nsg_status[3] simjob.write_properties() return if (validate_only): return try: sm = 'false' if simjob.server_status_email: sm = 'true' status = nsg.submitJobTemplate(simjob.job_directory_absolute, metadata={"statusEmail": sm}) simjob.server_remote_identifier = status.jobUrl simjob.write_properties() if status.isError(): simjob.append_log("NSG template submit failed. See debug.") else: simjob.append_log("NSG template submit success") simjob.status = ServerInterface.nsg_status[0] simjob.write_properties() except CipresError as e: simjob.append_log("Error submitting NSG template: " + e.message) simjob.append_log("Job stopped") return