12 self.assertEqual(job_manager.name,
'job_manager')
13 self.assertEqual(job_manager.command,
'java')
16 job_manager =
JobManager(steering=
"steering", inputs=[
"some/path/to/input.slcio"], outputs=[
"some/path/to/output.slcio"], overlay_file=
"some/path/to/overlay.slcio")
17 self.assertEqual(job_manager.name,
'job_manager')
18 self.assertEqual(job_manager.command,
'java')
19 self.assertEqual(job_manager.inputs, [
"some/path/to/input.slcio"])
20 self.assertEqual(job_manager.outputs, [
"some/path/to/output.slcio"])
21 self.assertEqual(job_manager.steering,
"steering")
22 self.assertEqual(job_manager.append_tok,
"steering")
23 self.assertEqual(job_manager.overlay_file,
"some/path/to/overlay.slcio")
27 self.assertEqual(job_manager.required_parameters(), [
'steering_files'])
31 self.assertEqual(job_manager.required_config(), [
'hps_java_bin_jar',
'hps_fieldmaps_dir'])
35 self.assertEqual(job_manager.optional_parameters(), [
'detector',
'run_number',
'defs'])
39 parser = configparser.ConfigParser()
40 config_file = [
'test_helpers/.hpsmc_test_cfg']
41 parser.read(config_file)
42 job_manager.config(parser)
43 self.assertEqual(job_manager.hps_fieldmaps_dir,
'some/fieldmaps/dir')
44 self.assertEqual(job_manager.hps_java_bin_jar,
'some/path/to/hps-java-bin.jar')
45 self.assertEqual(job_manager.conditions_url,
'http://some/path/to/conditions')
49 parser = configparser.ConfigParser()
50 config_file = [
'test_helpers/.hpsmc_test_cfg_invalid']
51 parser.read(config_file)
52 self.assertRaises(Exception,
lambda: job_manager.config(parser))
55 job_manager =
JobManager(steering=
"steering", inputs=[
"some/path/to/input.slcio"], outputs=[
"some/path/to/output.slcio"])
56 parser = configparser.ConfigParser()
57 config_file = [
'test_helpers/.hpsmc_test_cfg']
58 parser.read(config_file)
59 job_manager.config(parser)
60 params = {
'steering_files': {
'steering':
'some/path/to/steering.lcsim'}}
61 job_manager.set_parameters(params)
63 self.assertEqual(job_manager.steering_file,
"some/path/to/steering.lcsim")
64 self.assertEqual(job_manager.hps_fieldmaps_dir,
"some/fieldmaps/dir")
65 os.remove(os.getcwd() +
'/fieldmap')
68 job_manager =
JobManager(steering=
"invalid_steering", inputs=[
"some/path/to/input.slcio"], outputs=[
"some/path/to/output.slcio"])
69 parser = configparser.ConfigParser()
70 config_file = [
'test_helpers/.hpsmc_test_cfg']
71 parser.read(config_file)
72 job_manager.config(parser)
73 params = {
'steering_files': {
'steering':
'some/path/to/steering.lcsim'}}
74 job_manager.set_parameters(params)
75 self.assertRaises(Exception,
lambda: job_manager.setup())
78 job_manager =
JobManager(steering=
"steering", inputs=[
"some/path/to/input.slcio"], outputs=[
"some/path/to/output.slcio"])
79 parser = configparser.ConfigParser()
80 config_file = [
'test_helpers/.hpsmc_test_cfg']
81 parser.read(config_file)
82 job_manager.config(parser)
83 params = {
'steering_files': {
'steering':
'some/path/to/steering.lcsim'},
'detector':
'some_detector',
'run_number': 1,
'event_print_interval': 10,
'nevents': 1}
84 job_manager.set_parameters(params)
86 print(job_manager.cmd_args())
87 self.assertEqual(job_manager.cmd_args(), [
"-Dorg.hps.conditions.url=http://some/path/to/conditions",
"-jar",
"some/path/to/hps-java-bin.jar",
"-R",
"1",
"-d",
"some_detector",
"-D",
"outputFile=some/path/to/output",
"-r",
"some/path/to/steering.lcsim",
"-i",
"some/path/to/input.slcio"])
90 if __name__ ==
'__main__':