Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger bug hotfix #543

Merged
merged 3 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/vm_scheduling/offline_lp/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
config = convert_dottable(raw_config)

LOG_PATH = os.path.join(FILE_PATH, "log", config.experiment_name)
simulation_logger = Logger(tag="simulation", format_=LogFormat.none, dump_path=LOG_PATH, dump_mode="w")
ilp_logger = Logger(tag="ilp", format_=LogFormat.none, dump_path=LOG_PATH, dump_mode="w")
simulation_logger = Logger(tag="simulation", format_=LogFormat.none, dump_folder=LOG_PATH, dump_mode="w")
ilp_logger = Logger(tag="ilp", format_=LogFormat.none, dump_folder=LOG_PATH, dump_mode="w")

if __name__ == "__main__":
start_time = timeit.default_timer()
Expand Down
24 changes: 17 additions & 7 deletions maro/cli/inspector/env_data_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,23 @@ def _get_index_index_name_conversion(scenario: GlobalScenarios, source_path: str
if os.path.exists(os.path.join(source_path, GlobalFileNames.name_convert)):
os.remove(os.path.join(source_path, GlobalFileNames.name_convert))
if scenario == GlobalScenarios.CITI_BIKE:
with open(conversion_path, "r", encoding="utf8")as mapping_file:
mapping_json_data = json.load(mapping_file)
name_list = []
for item in mapping_json_data["data"]["stations"]:
name_list.append(item["name"])
df = pd.DataFrame({"name": name_list})
df.to_csv(os.path.join(source_path, GlobalFileNames.name_convert), index=False)
# TODO: the commented out code are older version which will cause errors.
# TODO: the updated code could work but the fix is temporary.
# TODO: we need to refactor the dump logic in citi bike scenario and make a stable solution later.

# with open(conversion_path, "r", encoding="utf8")as mapping_file:
# mapping_json_data = json.load(mapping_file)
# name_list = []
# for item in mapping_json_data["data"]["stations"]:
# name_list.append(item["name"])
# df = pd.DataFrame({"name": name_list})
# df.to_csv(os.path.join(source_path, GlobalFileNames.name_convert), index=False)

df_station = pd.read_csv(os.path.join(source_path, "epoch_0", "stations.csv"))
name_list = df_station["name"].unique()
df = pd.DataFrame({"name": name_list})
df.to_csv(os.path.join(source_path, GlobalFileNames.name_convert), index=False)

elif scenario == GlobalScenarios.CIM:
cim_information = yaml.load(
open(conversion_path, "r").read(),
Expand Down
4 changes: 2 additions & 2 deletions maro/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ def __init__(self):
if self.log_level == logging.DEBUG:
super().__init__(
tag='cli',
format_=LogFormat.cli_debug, dump_path=dump_path, dump_mode='a', stdout_level=self.log_level
format_=LogFormat.cli_debug, dump_folder=dump_path, dump_mode='a', stdout_level=self.log_level
)
elif self.log_level >= logging.INFO:
super().__init__(
tag='cli',
format_=LogFormat.cli_info, dump_path=dump_path, dump_mode='a', stdout_level=self.log_level
format_=LogFormat.cli_info, dump_folder=dump_path, dump_mode='a', stdout_level=self.log_level
)

_logger = None
Expand Down