def test_retrieve_results_folder(self): job = Job(2) self.assertEqual(job.results, ['2_test_folder/testres.htm', '2_test_folder/subdir/subres.html'])
def setUp(self): self.job = Job(1) self.options = {"option1": False, "option2": 25, "option3": "NEW"} self._delete_path = [] self._delete_dir = [] _, self._job_folder = get_mountpoint("job")[0]
def _construct_job_graph(self, user, analysis, commands, comm_opts=None, rarefaction_depth=None): """Builds the job graph for running an analysis Parameters ---------- user : str user running this analysis. analysis: Analysis object Analysis to finalize. commands : list of tuples Commands to add as jobs in the analysis. Format [(data_type, command name), ...] comm_opts : dict of dicts, optional Options for commands. Format {command name: {opt1: value,...},...} Default None (use default options). rarefaction_depth : int, optional Rarefaction depth for analysis' biom tables. Default None. """ self._logger = stderr # Add jobs to analysis if comm_opts is None: comm_opts = {} for data_type, command in commands: # get opts set by user, else make it empty dict opts = comm_opts.get(command, {}) # Add commands to analysis as jobs # HARD CODED HACKY THING FOR DEMO, FIX Issue #164 if (command == "Beta Diversity" or command == "Alpha Rarefaction"): if data_type in {'16S', '18S'}: opts["--tree_fp"] = join(get_db_files_base_dir(), "reference", "gg_97_otus_4feb2011.tre") else: opts["--parameter_fp"] = join(get_db_files_base_dir(), "reference", "params_qiime.txt") if command == "Alpha Rarefaction": opts["-n"] = 4 Job.create(data_type, command, opts, analysis, return_existing=True) # Create the files for the jobs files_node_name = "%d_ANALYSISFILES" % analysis.id self._job_graph.add_node(files_node_name, job=(_build_analysis_files, analysis, rarefaction_depth), requires_deps=False) # Add the jobs job_nodes = [] for job_id in analysis.jobs: job = Job(job_id) node_name = "%d_JOB_%d" % (analysis.id, job.id) job_nodes.append(node_name) self._job_graph.add_node(node_name, job=(_job_comm_wrapper, user, analysis.id, job), requires_deps=False) # Adding the dependency edges to the graph self._job_graph.add_edge(files_node_name, node_name) # Finalize the analysis node_name = "FINISH_ANALYSIS_%d" % analysis.id self._job_graph.add_node(node_name, job=(_finish_analysis, user, analysis), requires_deps=False) # Adding the dependency edges to the graph for job_node_name in job_nodes: self._job_graph.add_edge(job_node_name, node_name)
def test_remove_highlight(self): self.collection.remove_highlight(Job(1)) obs = self.collection.highlights exp = [] self.assertEqual(obs, exp)
def test_highlight_job(self): self.collection.highlight_job(Job(2)) obs = self.collection.highlights exp = [1, 2] self.assertEqual(obs, exp)
def test_not_equal(self): commands = Command.create_list() self.assertFalse(commands[1] != commands[1]) self.assertTrue(commands[1] != commands[2]) self.assertTrue(commands[1] != Job(1))
def setUp(self): self.job = Job(1) self.options = {"option1": False, "option2": 25, "option3": "NEW"} self._delete_path = [] self._delete_dir = []