@@ -35,22 +35,20 @@ class GymlibIntegtestManager:
35
35
BENCHMARK = "tpch"
36
36
SCALE_FACTOR = 0.01
37
37
DBGYM_CONFIG_PATH = Path ("env/tests/gymlib_integtest_dbgym_config.yaml" )
38
-
39
- # This is set at most once by set_up_workspace().
40
- DBGYM_WORKSPACE : Optional [DBGymWorkspace ] = None
38
+ WORKSPACE_PATH : Optional [Path ] = None
41
39
42
40
@staticmethod
43
41
def set_up_workspace () -> None :
44
42
"""
45
43
Set up the workspace if it has not already been set up.
46
44
None of the integtest_*.py files will delete the workspace so that future tests run faster.
47
45
"""
48
- workspace_path = get_workspace_path_from_config (
46
+ GymlibIntegtestManager . WORKSPACE_PATH = get_workspace_path_from_config (
49
47
GymlibIntegtestManager .DBGYM_CONFIG_PATH
50
48
)
51
49
52
50
# This if statement prevents us from setting up the workspace twice, which saves time.
53
- if not workspace_path .exists ():
51
+ if not GymlibIntegtestManager . WORKSPACE_PATH .exists ():
54
52
subprocess .run (
55
53
["./env/tests/_set_up_gymlib_integtest_workspace.sh" ],
56
54
env = {
@@ -64,23 +62,13 @@ def set_up_workspace() -> None:
64
62
check = True ,
65
63
)
66
64
67
- # Once we get here, we have an invariant that the workspace exists. We need this
68
- # invariant to be true in order to create the DBGymWorkspace.
69
- #
70
- # However, it also can't be created more than once so we need to check `is None`.
71
- if GymlibIntegtestManager .DBGYM_WORKSPACE is None :
72
- # Reset this in case it had been created by a test *not* using GymlibIntegtestManager.set_up_workspace().
73
- DBGymWorkspace ._num_times_created_this_run = 0
74
- GymlibIntegtestManager .DBGYM_WORKSPACE = DBGymWorkspace (workspace_path )
75
-
76
65
@staticmethod
77
- def get_dbgym_workspace () -> DBGymWorkspace :
78
- assert GymlibIntegtestManager .DBGYM_WORKSPACE is not None
79
- return GymlibIntegtestManager .DBGYM_WORKSPACE
66
+ def get_workspace_path () -> Path :
67
+ assert GymlibIntegtestManager .WORKSPACE_PATH is not None
68
+ return GymlibIntegtestManager .WORKSPACE_PATH
80
69
81
70
@staticmethod
82
71
def get_default_metadata () -> TuningMetadata :
83
- dbgym_workspace = GymlibIntegtestManager .get_dbgym_workspace ()
84
72
assert GymlibIntegtestManager .BENCHMARK == "tpch"
85
73
suffix = get_workload_suffix (
86
74
GymlibIntegtestManager .BENCHMARK ,
@@ -91,23 +79,25 @@ def get_default_metadata() -> TuningMetadata:
91
79
return TuningMetadata (
92
80
workload_path = fully_resolve_path (
93
81
get_workload_symlink_path (
94
- dbgym_workspace . dbgym_workspace_path ,
82
+ GymlibIntegtestManager . get_workspace_path () ,
95
83
GymlibIntegtestManager .BENCHMARK ,
96
84
GymlibIntegtestManager .SCALE_FACTOR ,
97
85
suffix ,
98
86
),
99
87
),
100
88
pristine_dbdata_snapshot_path = fully_resolve_path (
101
89
get_dbdata_tgz_symlink_path (
102
- dbgym_workspace . dbgym_workspace_path ,
90
+ GymlibIntegtestManager . get_workspace_path () ,
103
91
GymlibIntegtestManager .BENCHMARK ,
104
92
GymlibIntegtestManager .SCALE_FACTOR ,
105
93
),
106
94
),
107
95
dbdata_parent_path = fully_resolve_path (
108
- get_tmp_path_from_workspace_path (dbgym_workspace .dbgym_workspace_path ),
96
+ get_tmp_path_from_workspace_path (
97
+ GymlibIntegtestManager .get_workspace_path ()
98
+ ),
109
99
),
110
100
pgbin_path = fully_resolve_path (
111
- get_pgbin_symlink_path (dbgym_workspace . dbgym_workspace_path ),
101
+ get_pgbin_symlink_path (GymlibIntegtestManager . get_workspace_path () ),
112
102
),
113
103
)
0 commit comments