示例#1
0
 def test_force_lock_removal(self):
     test1 = ScriptTask.from_str("python -c 'print(\"test1\")'", {'store_stdout': True})
     fw = Firework(test1, {"_dupefinder": DupeFinderExact()}, fw_id=1)
     self.lp.add_wf(fw)
     # add a manual lock
     with WFLock(self.lp, 1):
         with WFLock(self.lp, 1, kill=True, expire_secs=1):
             self.assertTrue(True)  # dummy to make sure we got here
示例#2
0
    def test_dupefinder(self):
        test1 = ScriptTask.from_str("python -c 'print(\"test1\")'", {'store_stdout': True})
        fw = Firework(test1, {"_dupefinder": DupeFinderExact()})
        self.lp.add_wf(fw)
        self.lp.add_wf(fw)
        launch_rocket(self.lp, self.fworker)
        launch_rocket(self.lp, self.fworker)

        self.assertEqual(self.lp.launches.count(), 1)
示例#3
0
    def test_duplicate_delete_fw(self):
        test1 = ScriptTask.from_str("python -c 'print(\"test1\")'", {'store_stdout': True})
        fw = Firework(test1, {"_dupefinder": DupeFinderExact()})
        self.lp.add_wf(fw)
        self.lp.add_wf(fw)
        launch_rocket(self.lp, self.fworker)
        launch_rocket(self.lp, self.fworker)

        self.lp.delete_wf(2)
        self.assertRaises(ValueError, self.lp.get_fw_by_id, 2)
        self.assertEqual(self.lp.get_launch_by_id(1).action.stored_data[
            'stdout'], 'test1\n')
示例#4
0
    def test_duplicate_delete_fw(self):
        test1 = ScriptTask.from_str("python -c 'print(\"test1\")'", {'store_stdout': True})
        fw = Firework(test1, {"_dupefinder": DupeFinderExact()})
        self.lp.add_wf(fw)
        self.lp.add_wf(fw)
        launch_rocket(self.lp, self.fworker)
        # TODO: if test keeps failing on Travis, add an explicit check of nlaunches>0 in the database here
        # this will ensure the first Rocket is actually in the DB
        launch_rocket(self.lp, self.fworker)

        run_id = self.lp.get_launch_by_id(1).fw_id
        del_id = 1 if run_id == 2 else 2
        self.lp.delete_wf(del_id)
        self.assertRaises(ValueError, self.lp.get_fw_by_id, del_id)
        self.assertEqual(self.lp.get_launch_by_id(1).action.stored_data[
            'stdout'], 'test1\n')
示例#5
0
    def test_dupefinder(self):
        test1 = ScriptTask.from_str("python -c 'print(\"test1\")'", {'store_stdout': True})
        fw = Firework(test1, {"_dupefinder": DupeFinderExact()})
        self.lp.add_wf(fw)
        self.lp.add_wf(fw)
        launch_rocket(self.lp, self.fworker)
        # TODO: if test keeps failing on Travis, add an explicit check of nlaunches>0 in the database here
        # this will ensure the first Rocket is actually in the DB
        launch_rocket(self.lp, self.fworker)

        if self.lp.launches.count() > 1:
            print("TOO MANY LAUNCHES FOUND!")
            print("--------")
            for d in self.lp.launches.find():
                print(d)
            print("--------")
        self.assertEqual(self.lp.launches.count(), 1)