def handle(self, *args, **options): if options["job_id"] is None: logger.error("You must specify a job ID.") return 1 try: job_type = ProcessorPipeline[options["job_name"]] except KeyError: logger.error("You must specify a valid job name.") return 1 if job_type is ProcessorPipeline.AFFY_TO_PCL: affy_to_pcl(options["job_id"]) elif job_type is ProcessorPipeline.TRANSCRIPTOME_INDEX: build_transcriptome_index(options["job_id"]) elif job_type is ProcessorPipeline.NO_OP: no_op_processor(options["job_id"]) else: logger.error( ("A valid job name was specified for job %s with id %d but " "no processor function is known to run it."), options["job_name"], options["job_id"]) return 1 return 0
def handle(self, *args, **options): if options["job_id"] is None: logger.error("You must specify a job ID.", job_id=options["job_id"]) sys.exit(1) try: job_type = ProcessorPipeline[options["job_name"]] except KeyError: logger.error("You must specify a valid job name.", job_name=options["job_name"], job_id=options["job_id"]) sys.exit(1) if job_type is ProcessorPipeline.AFFY_TO_PCL: from data_refinery_workers.processors.array_express import affy_to_pcl affy_to_pcl(options["job_id"]) elif job_type is ProcessorPipeline.TRANSCRIPTOME_INDEX_SHORT: from data_refinery_workers.processors.transcriptome_index import build_transcriptome_index build_transcriptome_index(options["job_id"], length="short") elif job_type is ProcessorPipeline.TRANSCRIPTOME_INDEX_LONG: from data_refinery_workers.processors.transcriptome_index import build_transcriptome_index build_transcriptome_index(options["job_id"], length="long") elif job_type is ProcessorPipeline.AGILENT_TWOCOLOR_TO_PCL: from data_refinery_workers.processors.agilent_twocolor import agilent_twocolor_to_pcl agilent_twocolor_to_pcl(options["job_id"]) elif job_type is ProcessorPipeline.ILLUMINA_TO_PCL: from data_refinery_workers.processors.illumina import illumina_to_pcl illumina_to_pcl(options["job_id"]) elif job_type is ProcessorPipeline.SALMON: from data_refinery_workers.processors.salmon import salmon salmon(options["job_id"]) elif job_type is ProcessorPipeline.SMASHER: from data_refinery_workers.processors.smasher import smash smash(options["job_id"]) elif job_type is ProcessorPipeline.NO_OP: from data_refinery_workers.processors.no_op import no_op_processor no_op_processor(options["job_id"]) elif job_type is ProcessorPipeline.JANITOR: from data_refinery_workers.processors.janitor import run_janitor run_janitor(options["job_id"]) elif job_type is ProcessorPipeline.QN_REFERENCE: from data_refinery_workers.processors import qn_reference qn_reference.create_qn_reference(options["job_id"]) else: logger.error( ("A valid job name was specified for job %s with id %d but " "no processor function is known to run it."), options["job_name"], options["job_id"]) sys.exit(1) sys.exit(0)
def test_tx(self): """ """ # Make sure the work dirs don't exist cause this will fail the job. shutil.rmtree( "/home/user/data_store/raw/TEST/TRANSCRIPTOME_INDEX/" "AEGILOPS_TAUSCHII/SHORT/processor_job_1", ignore_errors=True, ) shutil.rmtree( "/home/user/data_store/raw/TEST/TRANSCRIPTOME_INDEX/" "AEGILOPS_TAUSCHII/LONG/processor_job_2", ignore_errors=True, ) job1 = prepare_job("short") job_context1 = transcriptome_index.build_transcriptome_index( job1.pk, length="short", cleanup=False) job1 = ProcessorJob.objects.get(id=job1.pk) self.assertTrue(job1.success) self.assertEqual(job_context1["length"], "short") job2 = prepare_job("long") job_context2 = transcriptome_index.build_transcriptome_index( job2.pk, length="long", cleanup=False) job2 = ProcessorJob.objects.get(id=job2.pk) self.assertTrue(job2.success) self.assertEqual(job_context2["length"], "long") self.assertNotEqual(job_context1["output_dir"], job_context2["output_dir"]) self.assertTrue( os.path.exists( job_context1["computed_file"].get_synced_file_path())) self.assertTrue( os.path.exists( job_context2["computed_file"].get_synced_file_path())) self.assertNotEqual( job_context1["computed_file"].get_synced_file_path(), job_context2["computed_file"].get_synced_file_path(), ) # This is the same logic as in `salmon._find_index` file = job_context1["computed_file"] unpacked = "/".join(file.get_synced_file_path().split("/")[:-1]) self.assertTrue("SHORT" in unpacked) file2 = job_context2["computed_file"] unpacked2 = "/".join(file2.get_synced_file_path().split("/")[:-1]) self.assertTrue("LONG" in unpacked2)