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

Adding warning to point people to 529 #530

Merged
merged 5 commits into from
Aug 27, 2021
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
File renamed without changes.
1 change: 0 additions & 1 deletion mephisto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import os


here = os.path.abspath(os.path.dirname(__file__))

try:
Expand Down
27 changes: 27 additions & 0 deletions mephisto/operations/hydra_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
from mephisto.abstractions.architect import ArchitectArgs
from mephisto.abstractions.crowd_provider import ProviderArgs
from mephisto.data_model.task_config import TaskConfigArgs
from mephisto.operations.logger_core import get_logger
from dataclasses import dataclass, field
from omegaconf import MISSING
from typing import List, Any

logger = get_logger(name=__name__)

config = ConfigStoreWithProvider("mephisto")


Expand Down Expand Up @@ -56,4 +59,28 @@ def initialize_named_configs():


def register_script_config(name: str, module: Any):
check_for_hydra_compat()
config.store(name=name, node=module)


def check_for_hydra_compat():
# Required for determining 0.3.x to 0.4.0 conversion
# of scripts
import inspect
import os

callsite = inspect.stack(0)[-1].filename
for entry in inspect.stack(0):
print(entry.filename)
call_dir = os.path.dirname(os.path.join(".", callsite))
if "hydra_configs" not in os.listdir(call_dir):
logger.warning(
"\u001b[31;1m"
f"We noticed you don't have a hydra_configs directory in the folder "
f"{call_dir} where you are running this script from.\n"
"Mephisto Version 0.4.0 has breaking changes for user scripts due "
"to the Hydra 1.1 upgrade. This may prevent scripts from launching. "
"See https://github.com/facebookresearch/Mephisto/issues/529 for "
"remediation details."
"\u001b[0m"
)
4 changes: 2 additions & 2 deletions mephisto/operations/logger_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# LICENSE file in the root directory of this source tree.

import logging
from typing import Optional
from typing import Optional, Dict

loggers = {}
loggers: Dict[str, logging.Logger] = {}
global_log_level = logging.INFO


Expand Down