Exemple #1
0
    def test_fixed(self):
        """this tests executes a job that requires exactly 4 processors"""

        j = Job()

        j.setName("MP-test")
        j.setExecutable(self.mpExe)
        j.setInputSandbox(
            find_all("mpTest.py", rootPath, "DIRAC/tests/Utilities")[0])
        j.setNumberOfProcessors(
            4)  # This requires a fixed number of processors
        j.setLogLevel("DEBUG")
        try:
            # This is the standard location in Jenkins
            j.setInputSandbox(
                find_all("pilot.cfg",
                         os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
        except (IndexError, KeyError):
            j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
        j.setConfigArgs("pilot.cfg")
        res = j.runLocal(self.d)
        if multiprocessing.cpu_count() > 1:
            self.assertTrue(res["OK"])
        else:
            self.assertFalse(res["OK"])
Exemple #2
0
    def test_min2(self):
        """this tests executes a job that requires at least 2 processors"""

        j = Job()

        j.setName("MP-test-min2")

        # FIXME: the number of processors should be discovered at runtime using JobParameters.getNumberOfJobProcessors()
        # here, and later
        j.setExecutable(self.mpExeFlex, arguments="2")
        j.setInputSandbox(
            find_all("mpTest-flexible.py", rootPath,
                     "DIRAC/tests/Utilities")[0])
        j.setNumberOfProcessors(
            minNumberOfProcessors=2)  # This requires at least 2 processors
        j.setLogLevel("DEBUG")
        try:
            # This is the standard location in Jenkins
            j.setInputSandbox(
                find_all("pilot.cfg",
                         os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
        except (IndexError, KeyError):
            j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
        j.setConfigArgs("pilot.cfg")
        res = j.runLocal(self.d)
        self.assertTrue(res["OK"])
Exemple #3
0
    def test_min2max4(self):
        """ this tests executes a job that requires 2 to 4 processors
    """

        j = Job()

        j.setName("MP-test-min2max4")
        j.setExecutable(self.mpExeFlex, arguments='2')
        j.setInputSandbox(
            find_all('mpTest-flexible.py', rootPath,
                     'DIRAC/tests/Utilities')[0])
        j.setNumberOfProcessors(
            minNumberOfProcessors=2,
            maxNumberOfProcessors=4)  # This requires 2 to 4 processors
        j.setLogLevel('DEBUG')
        try:
            # This is the standard location in Jenkins
            j.setInputSandbox(
                find_all('pilot.cfg',
                         os.environ['WORKSPACE'] + '/PilotInstallDIR')[0])
        except (IndexError, KeyError):
            j.setInputSandbox(find_all('pilot.cfg', rootPath)[0])
        j.setConfigArgs('pilot.cfg')
        res = j.runLocal(self.d)
        self.assertTrue(res['OK'])
class RegressionTestCase(IntegrationTest):
    """Base class for the Regression test cases"""
    def setUp(self):
        super(RegressionTestCase, self).setUp()

        gLogger.setLevel("DEBUG")
        self.dirac = Dirac()

        try:
            exeScriptLoc = find_all("exe-script.py", rootPath,
                                    "/DIRAC/tests/Workflow")[0]
            helloWorldLoc = find_all("helloWorld.py", rootPath,
                                     "/DIRAC/tests/Workflow")[0]
        except IndexError:  # we are in Jenkins
            exeScriptLoc = find_all("exe-script.py", os.environ["WORKSPACE"],
                                    "/DIRAC/tests/Workflow")[0]
            helloWorldLoc = find_all("helloWorld.py", os.environ["WORKSPACE"],
                                     "/DIRAC/tests/Workflow")[0]

        shutil.copyfile(exeScriptLoc, "./exe-script.py")
        shutil.copyfile(helloWorldLoc, "./helloWorld.py")

        try:
            helloWorldXMLLocation = find_all(
                "helloWorld.xml", rootPath,
                "/DIRAC/tests/Workflow/Regression")[0]
        except IndexError:  # we are in Jenkins
            helloWorldXMLLocation = find_all(
                "helloWorld.xml", os.environ["WORKSPACE"],
                "/DIRAC/tests/Workflow/Regression")[0]

        self.j_u_hello = Job(helloWorldXMLLocation)
        self.j_u_hello.setConfigArgs("pilot.cfg")

        try:
            helloWorldXMLFewMoreLocation = find_all(
                "helloWorld.xml", rootPath,
                "/DIRAC/tests/Workflow/Regression")[0]
        except IndexError:  # we are in Jenkins
            helloWorldXMLFewMoreLocation = find_all(
                "helloWorld.xml", os.environ["WORKSPACE"],
                "/DIRAC/tests/Workflow/Regression")[0]

        self.j_u_helloPlus = Job(helloWorldXMLFewMoreLocation)
        self.j_u_helloPlus.setConfigArgs("pilot.cfg")

    def tearDown(self):
        try:
            os.remove("exe-script.py")
            os.remove("helloWorld.py")
        except OSError:
            pass
Exemple #5
0
    def test_execute(self):

        j = Job()

        j.setName("helloWorld-test")
        j.setExecutable(self.exeScriptLocation)
        j.setLogLevel("DEBUG")
        try:
            # This is the standard location in Jenkins
            j.setInputSandbox(
                find_all("pilot.cfg",
                         os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
        except (IndexError, KeyError):
            j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
        j.setConfigArgs("pilot.cfg")
        res = j.runLocal(self.d)
        self.assertTrue(res["OK"])
Exemple #6
0
    def test_execute(self):

        j = Job()

        j.setName("helloWorld-test")
        j.setExecutable(self.exeScriptLocation)
        j.setLogLevel('DEBUG')
        try:
            # This is the standard location in Jenkins
            j.setInputSandbox(
                find_all('pilot.cfg',
                         os.environ['WORKSPACE'] + '/PilotInstallDIR')[0])
        except (IndexError, KeyError):
            j.setInputSandbox(find_all('pilot.cfg', rootPath)[0])
        j.setConfigArgs('pilot.cfg')
        res = j.runLocal(self.d)
        self.assertTrue(res['OK'])
Exemple #7
0
    def test_execute(self):
        """just testing unix "ls" """

        job = Job()

        job.setName("ls-test")
        job.setExecutable("/bin/ls", "-l")
        job.setLogLevel("DEBUG")
        try:
            # This is the standard location in Jenkins
            job.setInputSandbox(
                find_all("pilot.cfg",
                         os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
        except (IndexError, KeyError):
            job.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
        job.setConfigArgs("pilot.cfg")
        res = job.runLocal(self.d)
        self.assertTrue(res["OK"])
Exemple #8
0
    def test_execute(self):
        """ just testing unix "ls"
    """

        job = Job()

        job.setName("ls-test")
        job.setExecutable("/bin/ls", '-l')
        job.setLogLevel('DEBUG')
        try:
            # This is the standard location in Jenkins
            job.setInputSandbox(
                find_all('pilot.cfg',
                         os.environ['WORKSPACE'] + '/PilotInstallDIR')[0])
        except (IndexError, KeyError):
            job.setInputSandbox(find_all('pilot.cfg', rootPath)[0])
        job.setConfigArgs('pilot.cfg')
        res = job.runLocal(self.d)
        self.assertTrue(res['OK'])
Exemple #9
0
    def test_execute(self):

        job = Job()
        job._siteSet = {"DIRAC.someSite.ch"}

        job.setName("helloWorld-test")
        job.setExecutable(
            self.helloWorld,
            arguments="This is an argument",
            logFile="aLogFileForTest.txt",
            parameters=[
                ("executable", "string", "", "Executable Script"),
                ("arguments", "string", "", "Arguments for executable Script"),
                ("applicationLog", "string", "", "Log file name"),
                ("someCustomOne", "string", "", "boh"),
            ],
            paramValues=[("someCustomOne", "aCustomValue")],
        )
        job.setBannedSites(["LCG.SiteA.com", "DIRAC.SiteB.org"])
        job.setOwner("ownerName")
        job.setOwnerGroup("ownerGroup")
        job.setName("jobName")
        job.setJobGroup("jobGroup")
        job.setType("jobType")
        job.setDestination("DIRAC.someSite.ch")
        job.setCPUTime(12345)
        job.setLogLevel("DEBUG")
        try:
            # This is the standard location in Jenkins
            job.setInputSandbox(
                find_all("pilot.cfg",
                         os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
        except (IndexError, KeyError):
            job.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
        job.setConfigArgs("pilot.cfg")

        res = job.runLocal(self.d)
        self.assertTrue(res["OK"])
Exemple #10
0
    def test_min1(self):
        """this tests executes a job that requires at least 1 processor"""

        j = Job()

        j.setName("MP-test-min1")
        j.setExecutable(self.mpExeFlex, arguments="2")
        j.setInputSandbox(
            find_all("mpTest-flexible.py", rootPath,
                     "DIRAC/tests/Utilities")[0])
        j.setNumberOfProcessors(
            minNumberOfProcessors=1)  # This requires 1 to infinite processors
        j.setLogLevel("DEBUG")
        try:
            # This is the standard location in Jenkins
            j.setInputSandbox(
                find_all("pilot.cfg",
                         os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
        except (IndexError, KeyError):
            j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
        j.setConfigArgs("pilot.cfg")
        res = j.runLocal(self.d)
        self.assertTrue(res["OK"])
Exemple #11
0
    def test_execute(self):

        job = Job()
        job._siteSet = {'DIRAC.someSite.ch'}

        job.setName("helloWorld-test")
        job.setExecutable(self.helloWorld,
                          arguments="This is an argument",
                          logFile="aLogFileForTest.txt",
                          parameters=[('executable', 'string', '',
                                       "Executable Script"),
                                      ('arguments', 'string', '',
                                       'Arguments for executable Script'),
                                      ('applicationLog', 'string', '',
                                       "Log file name"),
                                      ('someCustomOne', 'string', '', "boh")],
                          paramValues=[('someCustomOne', 'aCustomValue')])
        job.setBannedSites(['LCG.SiteA.com', 'DIRAC.SiteB.org'])
        job.setOwner('ownerName')
        job.setOwnerGroup('ownerGroup')
        job.setName('jobName')
        job.setJobGroup('jobGroup')
        job.setType('jobType')
        job.setDestination('DIRAC.someSite.ch')
        job.setCPUTime(12345)
        job.setLogLevel('DEBUG')
        try:
            # This is the standard location in Jenkins
            job.setInputSandbox(
                find_all('pilot.cfg',
                         os.environ['WORKSPACE'] + '/PilotInstallDIR')[0])
        except (IndexError, KeyError):
            job.setInputSandbox(find_all('pilot.cfg', rootPath)[0])
        job.setConfigArgs('pilot.cfg')

        res = job.runLocal(self.d)
        self.assertTrue(res['OK'])