Example #1
0
    def test_extract_process_single(self):
        db_obj = FakeDBObj(self)
        job_list = {
            "job_name": ["wf_manifest-0", "wf_manifest-1", "sim_job"],
            "id_job": [0, 1, 2],
            "time_submit": [1, 3, 4],
            "time_start": [1, 15, 17],
            "time_end": [11, 0, 40],
            "cpus_alloc": [100, 100, 300]
        }
        we = WorkflowsExtractor()

        we.extract(job_list)
        we.do_processing()

        self.assertEqual(len(we._workflows), 1)
        self.assertEqual(list(we._workflows.keys()), ["manifest-0"])

        wt = we.get_workflow("manifest-0")
        t0 = wt.get_all_tasks()[0]
        #t1 = wt._tasks["S1"]
        #t2 = wt._tasks["S2"]
        #t3 = wt._tasks["S3"]
        self.assertEqual(wt._start_task, t0)
        self.assertEqual(wt._critical_path, [t0])
        self.assertEqual(wt._critical_path_runtime, 10)
        we.calculate_overall_results(True, db_obj, 1)
Example #2
0
    def test_extract_process(self):
        job_list = {
            "job_name": [
                "wf_manifest-2", "wf_manifest-2_S0", "wf_manifest-2_S1_dS0",
                "wf_manifest-2_S2_dS0", "wf_manifest-2_S3_dS2",
                "wf_manifest-2_S4_dS3", "wf_manifest-2_S5_dS4-dS1",
                "wf_manifest-2_S6_dS0", "sim_job", "wf_manifest-3_S0",
                "wf_manifest-3_S1_dS0", "wf_manifest-3_S2_dS0",
                "wf_manifest-3_S3_dS1-dS2"
            ],
            "id_job": [2, 0, 1, 33, 3, 4, 5, 6, 7, 8, 9, 10, 11],
            "time_start": [1, 1, 15, 17, 22, 27, 42, 12, 20, 1, 15, 17, 22],
            "time_end": [1, 10, 20, 40, 25, 29, 50, 70, 30, 10, 20, 19, 25]
        }
        we = WorkflowsExtractor()

        we.extract(job_list)
        we.do_processing()

        self.assertEqual(len(we._workflows), 2)
        self.assertEqual(list(we._workflows.keys()),
                         ["manifest-2", "manifest-3"])

        wt = we.get_workflow("manifest-3")
        t0 = wt._tasks["S0"]
        t1 = wt._tasks["S1"]
        t2 = wt._tasks["S2"]
        t3 = wt._tasks["S3"]
        self.assertEqual(wt._start_task, t0)
        self.assertEqual(wt._critical_path, [t0, t1, t3])
        self.assertEqual(wt._critical_path_runtime, 24)
        wt = we.get_workflow("manifest-2")
        t0 = wt._tasks["S0"]
        t6 = wt._tasks["S6"]

        self.assertEqual(wt._start_task, t0)
        self.assertEqual(wt._critical_path, [t0, t6])
        self.assertEqual(wt._critical_path_runtime, 69)
Example #3
0
    def test_extract_process_wrong_dash_name(self):
        job_list = {
            "job_name": [
                "wf_floodplain.json-350", "wf_floodplain.json-350_S0",
                "wf_floodplain.json-350_S1",
                "wf_floodplain.json-350_S3-dS0-dS1",
                "wf_floodplain.json-350_S5-dS0-dS1",
                "wf_floodplain.json-350_S2-dS3-dS0",
                "wf_floodplain.json-350_S4-dS0-dS5",
                "wf_floodplain.json-350_S6-dS4-dS2"
            ],
            "id_job": [39794, 39796, 39797, 39798, 39799, 39800, 39801, 39802],
            "time_submit": [
                1420309202, 1420309202, 1420309202, 1420309202, 1420309202,
                1420309202, 1420309202, 1420309202
            ],
            "time_start": [
                1420318973, 1420318973, 1420318973, 1420358574, 1420358574,
                1420387379, 1420405383, 1420419788
            ],
            "time_end": [
                1420318973, 1420358573, 1420322573, 1420387374, 1420405374,
                1420398179, 1420419784, 1420435988
            ]
        }
        we = WorkflowsExtractor()

        we.extract(job_list)
        we.do_processing()

        self.assertEqual(len(we._workflows), 1)
        self.assertEqual(list(we._workflows.keys()), ["floodplain.json-350"])

        wt = we.get_workflow("floodplain.json-350")
        print("TASKS", list(wt._tasks.keys()))
        print("DEPS", [t.deps for t in list(wt._tasks.values())])
        print("CP", [x.name for x in wt._critical_path])
        self.assertEqual(wt.get_runtime(), 117015)
        self.assertEqual(wt.get_waittime(), 9771)
        self.assertEqual(wt.get_turnaround(), 9771 + 117015)