Exemplo n.º 1
0
class TestDag(unittest.TestCase):

    def setUp(self):
        """ Setup a test environment """
        self.job = CondorDag( 'test/test.dag', db_path='job.db', verbose=True)

    def tearDown(self):
        time.sleep( SLEEP_TIME )
        for f in glob.iglob( 'test/log.*' ):
            os.unlink( f )
        for f in glob.iglob( 'test/job.db' ):
            os.unlink( f )
        for f in glob.iglob( 'test/results_data_out' ):
            os.unlink( f )
        for f in glob.iglob( 'test/test.dag.*' ):
            os.unlink( f )


    def testSubmit( self ):
        """ Test job submission DAG """
        saved_stdout = sys.stdout
        try:
            out = StringIO()
            sys.stdout = out

            self.job.submit()

            output = out.getvalue().strip()
            assert output.find('Submitting job(s)')

        finally:

            sys.stdout = saved_stdout

    def testKill( self ):
        """ Test job remove DAG """
        saved_stdout = sys.stdout
        try:
            out = StringIO()
            sys.stdout = out

            self.job.kill()

            output = out.getvalue().strip()
            assert output.find('job(s) have been marked for removal.')

        finally:

            sys.stdout = saved_stdout
Exemplo n.º 2
0
class TestDag(unittest.TestCase):
    def setUp(self):
        """ Setup a test environment """
        self.job = CondorDag('test/test.dag', db_path='job.db', verbose=True)

    def tearDown(self):
        time.sleep(SLEEP_TIME)
        for f in glob.iglob('test/log.*'):
            os.unlink(f)
        for f in glob.iglob('test/job.db'):
            os.unlink(f)
        for f in glob.iglob('test/results_data_out'):
            os.unlink(f)
        for f in glob.iglob('test/test.dag.*'):
            os.unlink(f)

    def testSubmit(self):
        """ Test job submission DAG """
        saved_stdout = sys.stdout
        try:
            out = StringIO()
            sys.stdout = out

            self.job.submit()

            output = out.getvalue().strip()
            assert output.find('Submitting job(s)')

        finally:

            sys.stdout = saved_stdout

    def testKill(self):
        """ Test job remove DAG """
        saved_stdout = sys.stdout
        try:
            out = StringIO()
            sys.stdout = out

            self.job.kill()

            output = out.getvalue().strip()
            assert output.find('job(s) have been marked for removal.')

        finally:

            sys.stdout = saved_stdout
Exemplo n.º 3
0
 def setUp(self):
     """ Setup a test environment """
     self.job = CondorDag('test/test.dag', db_path='job.db', verbose=True)
Exemplo n.º 4
0
 def setUp(self):
     """ Setup a test environment """
     self.job = CondorDag( 'test/test.dag', db_path='job.db', verbose=True)