Belle II Software  release-06-00-14
TestJob Class Reference
Inheritance diagram for TestJob:
Collaboration diagram for TestJob:

Public Member Functions

def setUp (self)
 
def test_dict_setup (self)
 
def test_job_json_serialise (self)
 
def test_status (self)
 
def test_path_object_conversion (self)
 
def test_subjob_splitting (self)
 
def test_input_sandbox_copy (self)
 
def tearDown (self)
 

Public Attributes

 job1
 
 job2_dict
 
 job2
 
 maxDiff
 

Detailed Description

UnitTest for the `caf.backends.Job` class

Definition at line 35 of file test_backends.py.

Member Function Documentation

◆ setUp()

def setUp (   self)
Create useful objects for each test and the teardown

Definition at line 40 of file test_backends.py.

40  def setUp(self):
41  """
42  Create useful objects for each test and the teardown
43  """
44  # We will deliberately use strings and not Path objects for the job attributes so that we can later
45  # check that they are converted to Paths by the class itself.
46  name1 = 'TestJob1'
47  job1 = Job(name1) # Set up this one manually setting attributes
48  job1.working_dir = Path(test_dir, job1.name, "working_dir").absolute().as_posix()
49  job1.output_dir = Path(test_dir, job1.name, "output_dir").absolute().as_posix()
50  job1.cmd = ["bash", test_script.name]
51  job1.input_sandbox_files = [test_script.as_posix()]
52  self.job1 = job1
53 
54  name2 = 'TestJob2'
55  job_dict = {}
56  job_dict["name"] = name2
57  job_dict["working_dir"] = Path(test_dir, name2, "working_dir").as_posix()
58  job_dict["output_dir"] = Path(test_dir, name2, "output_dir").as_posix()
59  job_dict["output_patterns"] = []
60  job_dict["cmd"] = ["bash", test_script.name]
61  job_dict["args"] = []
62  job_dict["input_sandbox_files"] = [test_script.as_posix()]
63  job_dict["input_files"] = []
64  job_dict["setup_cmds"] = []
65  job_dict["backend_args"] = {}
66  job_dict["subjobs"] = [{"id": i, "input_files": [], "args": [str(i)]} for i in range(4)]
67  self.job2_dict = job_dict
68  self.job2 = Job(name2, job_dict=job_dict) # Set up this one from a dictionary
69 
70  # Create a directory just in case we need it for each test so that we can delete everything easily at the end
71  test_dir.mkdir(parents=True, exist_ok=False)
72 

◆ tearDown()

def tearDown (   self)
Removes files/directories that were created during these tests

Definition at line 202 of file test_backends.py.

◆ test_input_sandbox_copy()

def test_input_sandbox_copy (   self)
Does the copy of files/directories for the input sandbox work correctly?

Definition at line 174 of file test_backends.py.

◆ test_path_object_conversion()

def test_path_object_conversion (   self)
Make sure that the two ways of setting up Job objects correctly converted attributes to be Paths instead of strings.

Definition at line 103 of file test_backends.py.

◆ test_status()

def test_status (   self)
The Jobs haven't been run so they should be in the 'init' status.
They also shouldn't throw exceptions due to missing result objects.

Definition at line 87 of file test_backends.py.

◆ test_subjob_splitting()

def test_subjob_splitting (   self)
Test the creation of SubJobs and assignment of input data files via splitter classes.

Definition at line 125 of file test_backends.py.


The documentation for this class was generated from the following file: