def launch_instances(host, start_port, instances): """Launch multiple instances of Fusion 360""" launcher = Launcher() for port in range(start_port, start_port + instances): print(f"Launching Fusion 360 instance: {host}:{port}") launcher.launch() time.sleep(5)
def main(script_name, argv): species, read_type, job_name, dir_out, fastq_list, fastq_list_r2, library_type, project, run, toolset, \ flag_xenome, cores_per_sample, verbose, sync, genome, targeted_kit, sample_name_list, master_mode, \ novoalign_tune = parse_arguments(script_name, argv) if not library_type: library_type = "DNASeq" if not job_name: job_name = "{}_job".format(library_type) if not run: run = "{}_run".format(library_type) if not cores_per_sample: cores_per_sample = "4" if not novoalign_tune: novoalign_tune = "NA" if species == "human": human_kit = { 'SureSelect_v4': GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_HUMAN_SURE_SELECT_V4, 'SureSelect_v5': GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_HUMAN_SURE_SELECT_V5, 'SureSelect_v6': GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_HUMAN_SURE_SELECT_V6 } try: global_config_tool_template_name = human_kit[targeted_kit] except KeyError as e: raise ValueError('Only SureSelect_v4, SureSelect_v5, SureSelect_v6 target kits are available for human.', e.args[0]) elif species == "mouse": if targeted_kit != "Mouse_Exome_v1": raise ValueError('Only Mouse_Exome_v1 target kit is available for mouse.') global_config_tool_template_name = GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_MOUSE_EXOME_V1 else: raise ValueError('Failed to determine "species" parameter. Available species: "human"/"mouse"') additional_options = {"novoalign_tune": novoalign_tune} global_config = GlobalConfig(species, read_type, TEMPLATE, WORKFLOW_NAME, toolset) global_config_path = global_config.create(global_config_tool_template_name, additional_options, flag_xenome=flag_xenome, cores_per_sample=cores_per_sample) if os.path.isdir(fastq_list): fastq_list = FastqSampleManifest(read_type).create_by_folder(fastq_list, WORKFLOW_NAME, library_type) elif 'fastq.gz' in str(fastq_list).split(',')[0]: sample_name_list = list(str(sample_name_list).split(',')) if sample_name_list else None fastq_list = FastqSampleManifest(read_type).create_by_list(list(str(fastq_list).split(',')), list(str(fastq_list_r2).split(',')), WORKFLOW_NAME, library_type, sample_names=sample_name_list) study_config = StudyConfig(job_name, dir_out, fastq_list, None, library_type, run, project=project) study_config_path = study_config.parse(workflow=WORKFLOW_NAME) Launcher.launch(global_config_path, study_config_path, sync, java_path=global_config.java_path, verbose=verbose, master=master_mode)
def run(self, problem_id, domain_template, problem_template, facts_pdkb, goals_pdkb): """ Execute the planner and return the parsed output. Before the planner is executed the pddl problem file is created dynamically by inserting the knowledge base (kb_files) and the current goals (goal_files) at the right location in the problem template. @param problem_id The id for the particular problem/domain set @param domain_template The path of the pddl domain template @param problem_template The name of the pddl problem template that contains special insertion marks @param facts_pdkb The fact files to be inserted in the pddl problem file @param goals_pdkb The goal files to be inserted in the pddl problem file """ # insert the PDKB files into the PDDL templates (domain_file, problem_file) = compile_PDKB_to_PDDL(problem_id, domain_template, problem_template, facts_pdkb, goals_pdkb) # launch the planner and redirect output to parser l = Launcher(domain_file, problem_file) l.launch() p = Parser(l.get_output()) if print_planner_output: print l.get_output() # return the parsed plan return p
def run(self, problem_id, domain_template, problem_template, facts_pdkb, goals_pdkb): """ Execute the planner and return the parsed output. Before the planner is executed the pddl problem file is created dynamically by inserting the knowledge base (kb_files) and the current goals (goal_files) at the right location in the problem template. @param problem_id The id for the particular problem/domain set @param domain_template The path of the pddl domain template @param problem_template The name of the pddl problem template that contains special insertion marks @param facts_pdkb The fact files to be inserted in the pddl problem file @param goals_pdkb The goal files to be inserted in the pddl problem file """ # insert the PDKB files into the PDDL templates (domain_file, problem_file) = compile_PDKB_to_PDDL( problem_id, domain_template, problem_template, facts_pdkb, goals_pdkb) # launch the planner and redirect output to parser l = Launcher(domain_file, problem_file) l.launch() p = Parser(l.get_output()) if print_planner_output: print l.get_output() # return the parsed plan return p
def __launch_gym(self): """Launch the Fusion 360 Gym on the given host/port""" launcher = Launcher() self.p = launcher.launch() # We wait for Fusion to start responding to pings result = self.__wait_for_fusion() if result is False: # Fusion is awake but not responding so restart self.p.kill() self.p = None self.__launch_gym() else: return result
def main(): launcher = Launcher(sys.argv) obj = launcher.launch() Log.log(sys.argv) try: obj.poll() except BaseException as e: #This is here for debugging purposes if isinstance(e, Exception): Log.log(e) my_log = open(Log.log_file, 'a') traceback.print_exc(file=my_log) obj.cleanup() sys.exit(0)
def main(script_name, argv): species, read_type, job_name, dir_out, feature_reference, fastq_list, fastq_list_r2, libtype, master, \ expected_cells, forced_cells, chemistry, nosecondary, r1_length, r2_length, genome_build, transcriptome, \ vdj_genome, detect_doublet, project, run, toolset, cores_per_sample, verbose, sync, sample_name_list, \ master_mode, toolchain, target_panel, mem_free = parse_arguments(script_name, argv) library_type = "scRNASeq" if not read_type: read_type = "paired" if not job_name: job_name = "{}_job".format(library_type) if not run: run = "{}_run".format(library_type) if not expected_cells: expected_cells = "3000" if not forced_cells: forced_cells = "NA" if not nosecondary: nosecondary = "FALSE" if not cores_per_sample: cores_per_sample = "8" if not target_panel: target_panel = "NA" additional_options = { "feature_reference": feature_reference, "genome_build": genome_build, "genome": transcriptome, "transcriptome": transcriptome, "vdj_genome": vdj_genome, "expected_cells": expected_cells, "forced_cells": forced_cells, "chemistry": chemistry, "nosecondary": nosecondary, "r1_length": r1_length, "r2_length": r2_length, "target_panel": target_panel, "maxmem": mem_free } if not toolset: toolset = "count+vdj+qc" if detect_doublet and "doubletdetection" not in toolset: toolset += "+doubletdetection" global_config = GlobalConfig(species, read_type, TEMPLATE, WORKFLOW_NAME, toolset) if species == "human": global_config_tool_template_name = GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_HUMAN_TOOLCHAIN2 \ if toolchain == "Cellranger_v6" else GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_HUMAN_TOOLCHAIN1 elif species == "mouse": global_config_tool_template_name = GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_MOUSE_TOOLCHAIN2 \ if toolchain == "Cellranger_v6" else GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_MOUSE_TOOLCHAIN1 else: raise RuntimeError( 'Failed to determine "species" parameter. Available species: "human" and "mouse"' ) global_config_path = global_config.create( global_config_tool_template_name, additional_options, cores_per_sample=cores_per_sample) if os.path.isdir(fastq_list): fastq_list = FastqSampleManifest(read_type).create_by_folder( fastq_list, WORKFLOW_NAME, library_type) elif 'fastq.gz' in str(fastq_list).split(',')[0]: sample_libtype = list(str(libtype).split(',')) if libtype else None sample_master = list(str(master).split(',')) if master else None sample_name_list = list( str(sample_name_list).split(',')) if sample_name_list else None fastq_list = FastqSampleManifest(read_type).create_by_list( list(str(fastq_list).split(',')), list(str(fastq_list_r2).split(',')), WORKFLOW_NAME, library_type, sample_libtype=sample_libtype, sample_master=sample_master, sample_names=sample_name_list) study_config = StudyConfig(job_name, dir_out, fastq_list, None, library_type, run, project=project) study_config_path = study_config.parse(workflow=WORKFLOW_NAME) Launcher.launch(global_config_path, study_config_path, sync, java_path=global_config.java_path, verbose=verbose, master=master_mode)