standardised naming of test recipe scripts
This commit is contained in:
5
counting_files.py
Normal file
5
counting_files.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
dir_to_count = "."
|
||||||
|
|
||||||
|
print(f"There are {len(os.listdir(dir_to_count))} files in the directory.")
|
@ -136,8 +136,7 @@ class BashHandler(BaseHandler):
|
|||||||
JOB_TYPE_BASH,
|
JOB_TYPE_BASH,
|
||||||
event,
|
event,
|
||||||
extras={
|
extras={
|
||||||
JOB_PARAMETERS:yaml_dict,
|
JOB_PARAMETERS:yaml_dict
|
||||||
# CONTROL_SCRIPT:python_job_func
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
print_debug(self._print_target, self.debug_level,
|
print_debug(self._print_target, self.debug_level,
|
||||||
|
@ -1255,7 +1255,7 @@ COMPLETE_PYTHON_SCRIPT = [
|
|||||||
"",
|
"",
|
||||||
"print('done')"
|
"print('done')"
|
||||||
]
|
]
|
||||||
IDMC_UTILS_MODULE = [
|
IDMC_UTILS_PYTHON_SCRIPT = [
|
||||||
"import matplotlib.pyplot as plt",
|
"import matplotlib.pyplot as plt",
|
||||||
"from sklearn import mixture",
|
"from sklearn import mixture",
|
||||||
"import numpy as np",
|
"import numpy as np",
|
||||||
@ -1364,7 +1364,7 @@ IDMC_UTILS_MODULE = [
|
|||||||
" else:",
|
" else:",
|
||||||
" return means, stds, weights"
|
" return means, stds, weights"
|
||||||
]
|
]
|
||||||
GENERATE_SCRIPT = [
|
GENERATE_PYTHON_SCRIPT = [
|
||||||
"import numpy as np",
|
"import numpy as np",
|
||||||
"import random",
|
"import random",
|
||||||
"import foam_ct_phantom.foam_ct_phantom as foam_ct_phantom",
|
"import foam_ct_phantom.foam_ct_phantom as foam_ct_phantom",
|
||||||
@ -1391,7 +1391,9 @@ GENERATE_SCRIPT = [
|
|||||||
" np.save(filename, dataset)",
|
" np.save(filename, dataset)",
|
||||||
" del dataset"
|
" del dataset"
|
||||||
]
|
]
|
||||||
|
COUNTING_PYTHON_SCRIPT = [
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
valid_pattern_one = FileEventPattern(
|
valid_pattern_one = FileEventPattern(
|
||||||
"pattern_one", "path_one", "recipe_one", "file_one")
|
"pattern_one", "path_one", "recipe_one", "file_one")
|
||||||
|
@ -28,8 +28,8 @@ from meow_base.recipes.python_recipe import PythonHandler, PythonRecipe
|
|||||||
from shared import TEST_JOB_QUEUE, TEST_JOB_OUTPUT, TEST_MONITOR_BASE, \
|
from shared import TEST_JOB_QUEUE, TEST_JOB_OUTPUT, TEST_MONITOR_BASE, \
|
||||||
MAKER_RECIPE, APPENDING_NOTEBOOK, COMPLETE_PYTHON_SCRIPT, TEST_DIR, \
|
MAKER_RECIPE, APPENDING_NOTEBOOK, COMPLETE_PYTHON_SCRIPT, TEST_DIR, \
|
||||||
FILTER_RECIPE, POROSITY_CHECK_NOTEBOOK, SEGMENT_FOAM_NOTEBOOK, \
|
FILTER_RECIPE, POROSITY_CHECK_NOTEBOOK, SEGMENT_FOAM_NOTEBOOK, \
|
||||||
GENERATOR_NOTEBOOK, FOAM_PORE_ANALYSIS_NOTEBOOK, IDMC_UTILS_MODULE, \
|
GENERATOR_NOTEBOOK, FOAM_PORE_ANALYSIS_NOTEBOOK, IDMC_UTILS_PYTHON_SCRIPT, \
|
||||||
TEST_DATA, GENERATE_SCRIPT, setup, teardown, backup_before_teardown
|
TEST_DATA, GENERATE_PYTHON_SCRIPT, setup, teardown, backup_before_teardown
|
||||||
|
|
||||||
pattern_check = FileEventPattern(
|
pattern_check = FileEventPattern(
|
||||||
"pattern_check",
|
"pattern_check",
|
||||||
@ -1020,11 +1020,11 @@ class MeowTests(unittest.TestCase):
|
|||||||
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
||||||
make_dir(foam_data_dir)
|
make_dir(foam_data_dir)
|
||||||
|
|
||||||
write_file(lines_to_string(IDMC_UTILS_MODULE),
|
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
|
||||||
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
||||||
|
|
||||||
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
||||||
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
|
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
|
||||||
|
|
||||||
u_spec = importlib.util.spec_from_file_location("gen", gen_path)
|
u_spec = importlib.util.spec_from_file_location("gen", gen_path)
|
||||||
gen = importlib.util.module_from_spec(u_spec)
|
gen = importlib.util.module_from_spec(u_spec)
|
||||||
@ -1145,11 +1145,11 @@ class MeowTests(unittest.TestCase):
|
|||||||
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
||||||
make_dir(foam_data_dir)
|
make_dir(foam_data_dir)
|
||||||
|
|
||||||
write_file(lines_to_string(IDMC_UTILS_MODULE),
|
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
|
||||||
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
||||||
|
|
||||||
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
||||||
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
|
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
|
||||||
|
|
||||||
all_data = [1000] * good + [100] * big + [10000] * small
|
all_data = [1000] * good + [100] * big + [10000] * small
|
||||||
shuffle(all_data)
|
shuffle(all_data)
|
||||||
@ -1303,11 +1303,11 @@ class MeowTests(unittest.TestCase):
|
|||||||
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
||||||
make_dir(foam_data_dir)
|
make_dir(foam_data_dir)
|
||||||
|
|
||||||
write_file(lines_to_string(IDMC_UTILS_MODULE),
|
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
|
||||||
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
||||||
|
|
||||||
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
||||||
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
|
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
|
||||||
|
|
||||||
all_data = [1000] * good + [100] * big + [10000] * small
|
all_data = [1000] * good + [100] * big + [10000] * small
|
||||||
shuffle(all_data)
|
shuffle(all_data)
|
||||||
@ -1455,11 +1455,11 @@ class MeowTests(unittest.TestCase):
|
|||||||
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
|
||||||
make_dir(foam_data_dir)
|
make_dir(foam_data_dir)
|
||||||
|
|
||||||
write_file(lines_to_string(IDMC_UTILS_MODULE),
|
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
|
||||||
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
|
||||||
|
|
||||||
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
|
||||||
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
|
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
|
||||||
|
|
||||||
all_data = [1000] * good + [100] * big + [10000] * small
|
all_data = [1000] * good + [100] * big + [10000] * small
|
||||||
shuffle(all_data)
|
shuffle(all_data)
|
||||||
|
Reference in New Issue
Block a user