Source code for mojo.pavayo.testcase.parallelTestCase

"""
parallelTestCase.py
===================

parallelTestCase offers the class ParallelTestCaseSub, which represents a test case consisting of many independent calculations. It offers the possibility to use
a TRACE control file and add lines to this control file.

As soon as GeneralTestCase can handle TRACE control files ParallelTestCase will be replaced.
"""

from . import testcase_generated as supermod
from .abstractTestCase import AbstractTestCase
from .speedlineTestCase import SpeedlineTestCaseSub
from ...jobManagement.jobs.jobList import JobList
from .. import computeData as constants
from ..joblists.parallel import buildParallelJoblist


[docs]class ParallelTestCaseSub(supermod.ParallelTestCase, SpeedlineTestCaseSub, AbstractTestCase): """Class to represent a parallel test case. All possible parameters to the constructor of this class can be found in the XSD file used to generate testcase_generated.py. """
[docs] def getPostCommandJobs(self, options, executableDict, isParallelTestCase=True, resourcesDict=None): return super(ParallelTestCaseSub, self).getPostCommandJobs(options, executableDict, isParallelTestCase, resourcesDict=resourcesDict)
[docs] def getComputationJobList(self, options, executableDict, resourcesDict=None): """Collects all job objects from the jobs in the current test case instance and creates a job list of them. :param options: options instance to extract the executables and the queue to use :param executableDict: dictionary of executables :param resourcesDict: resources used by the jobs :type options: ArgparseParser :type executableDict: ExecutableResources :type resourcesDict: dict :return: a job list representing this test case or None :rtype: jobList or None """ lastJobId = [] myJobList = JobList(name=self.name + "_COMPUTATION_JOBLIST", verbosity=options.verbose, retries=options.retriesComputation, deactivateJobGrouping=options.deactivateClusterJobGrouping) preScriptJob = super(ParallelTestCaseSub, self).getPreScriptJob(executableDict) if preScriptJob: myJobList.addJob(preScriptJob) lastJobId = [preScriptJob.id] traceJobs = buildParallelJoblist(trace=executableDict[constants.TRACE_SUITE_TRACE_EXEC].path, testCase=self, options=options, name=self.name + "_PARALLEL") if traceJobs: myJobList.addJob(traceJobs, lastJobId) lastJobId = [traceJobs.id] postJobs = self.getPostCommandJobs(options, executableDict, resourcesDict=resourcesDict) if postJobs: for job in postJobs: myJobList.addJob(job, lastJobId) lastJobId = [job.id] if lastJobId: return myJobList else: return None
[docs] def getPostprocessingJobList(self, *args, **kwargs): """Returns a job containing the post script of the test case. :return: a job containing the post script of the test case :rtype: Job instance """ return super(ParallelTestCaseSub, self).getPostscriptJob(*args, **kwargs)