Skip to content

Commit 28b6878

Browse files
committed
+ try to activate data module in the launcher
1 parent d404dfa commit 28b6878

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

trinity/cli/launcher.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ def both(config: Config) -> None:
9595
logger.info("Eval step finished.")
9696

9797

98+
def activate_data_module(config: Config, config_path: str):
99+
"""Check whether to activate data module and preprocess datasets."""
100+
data_config = config.data
101+
if data_config.dj_config_path or data_config.dj_process_desc:
102+
from trinity.data.client import request, LOCAL_SERVER_URL
103+
logger.info("Activating data module...")
104+
res = request(
105+
url=LOCAL_SERVER_URL,
106+
configPath=config_path,
107+
)
108+
if res["return_code"] != 0:
109+
logger.error(f"Failed to activate data module: {res['return_msg']}.")
110+
return
111+
112+
98113
def main() -> None:
99114
"""The main entrypoint."""
100115
parser = argparse.ArgumentParser()
@@ -111,6 +126,8 @@ def main() -> None:
111126
# TODO: support parse all args from command line
112127
config = load_config(args.config)
113128
config.check_and_update()
129+
# try to activate data module
130+
activate_data_module(config, args.config)
114131
ray.init()
115132
if config.mode == "explore":
116133
explore(config)

0 commit comments

Comments
 (0)