Skip to content

panther ¤

Panther ¤

Panther()
Source code in panther/panther_worker/app/panther.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def __init__(self):
    # Setup cargo
    subprocess.Popen("", shell=True, executable="/bin/bash").wait()  # TODO source

    # Setup logger
    self.log = logging.getLogger("panther")
    self.log.setLevel(logging.INFO)
    if self.log.hasHandlers():
        self.log.handlers.clear()
    self.log.addHandler(ch)
    self.log.propagate = False

    # Setup argument parser
    self.args = ArgumentParserRunner().parse_arguments()

    # Setup environment variables
    for env_var in ENV_VAR:
        os.environ[env_var] = str(ENV_VAR[env_var])
        if DEBUG:
            self.log.info("ENV_VAR=" + env_var)
            self.log.info("ENV_VAL=" + str(ENV_VAR[env_var]))

    # Setup configuration
    self.log.info("Getting Experiment configuration:")
    (
        self.supported_protocols,
        self.current_protocol,
        self.tests_enabled,
        self.conf_implementation_enable,
        self.implementation_enable,
        self.protocol_model_path,
        self.protocol_results_path,
        self.protocol_test_path,
        self.config,
        self.protocol_conf,
    ) = get_experiment_config(None, False, False)

    self.log.info("Selected protocol: " + self.current_protocol)

    with os.scandir(self.protocol_results_path) as entries:
        self.total_exp_in_dir = sum(1 for entry in entries if entry.is_dir())
    self.current_exp_path = os.path.join(
        self.protocol_results_path, str(self.total_exp_in_dir)
    )

    self.available_test_modes = []
    self.included_files = list()

    if self.config["debug_parameters"].getboolean("memprof"):
        self.memory_snapshots = []

find_ivy_files ¤

find_ivy_files()

Recursively find all .ivy files in the specified folder and its subfolders, excluding those with 'test' in the filename.

:param root_folder: The root folder to start the search from. :return: A list of paths to the found .ivy files.

Source code in panther/panther_worker/app/panther.py
80
81
82
83
84
85
86
87
88
89
90
91
92
def find_ivy_files(self):
    """
    Recursively find all .ivy files in the specified folder and its subfolders, excluding those with 'test' in the filename.

    :param root_folder: The root folder to start the search from.
    :return: A list of paths to the found .ivy files.
    """
    ivy_files = []
    for dirpath, _, filenames in os.walk(self.protocol_model_path):
        for f in filenames:
            if f.endswith(".ivy") and "test" not in f:
                ivy_files.append(os.path.join(dirpath, f))
    return ivy_files