Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster/dagster/core/log_manager.py
import datetime | |||||
import itertools | import itertools | ||||
import logging | import logging | ||||
from collections import OrderedDict, namedtuple | from collections import OrderedDict, namedtuple | ||||
from dagster import check, seven | from dagster import check, seven | ||||
from dagster.core.utils import make_new_run_id | from dagster.core.utils import make_new_run_id | ||||
from dagster.seven import get_current_datetime_in_utc | |||||
from dagster.utils import frozendict, merge_dicts | from dagster.utils import frozendict, merge_dicts | ||||
from dagster.utils.error import SerializableErrorInfo | from dagster.utils.error import SerializableErrorInfo | ||||
DAGSTER_META_KEY = "dagster_meta" | DAGSTER_META_KEY = "dagster_meta" | ||||
PYTHON_LOGGING_LEVELS_MAPPING = frozendict( | PYTHON_LOGGING_LEVELS_MAPPING = frozendict( | ||||
OrderedDict({"CRITICAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10}) | OrderedDict({"CRITICAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10}) | ||||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | def _prepare_message(self, orig_message, message_props): | ||||
# Reserved keys in the message_props -- these are system generated. | # Reserved keys in the message_props -- these are system generated. | ||||
check.invariant("orig_message" not in message_props, "orig_message reserved value") | check.invariant("orig_message" not in message_props, "orig_message reserved value") | ||||
check.invariant("message" not in message_props, "message reserved value") | check.invariant("message" not in message_props, "message reserved value") | ||||
check.invariant("log_message_id" not in message_props, "log_message_id reserved value") | check.invariant("log_message_id" not in message_props, "log_message_id reserved value") | ||||
check.invariant("log_timestamp" not in message_props, "log_timestamp reserved value") | check.invariant("log_timestamp" not in message_props, "log_timestamp reserved value") | ||||
log_message_id = make_new_run_id() | log_message_id = make_new_run_id() | ||||
log_timestamp = datetime.datetime.utcnow().isoformat() | log_timestamp = get_current_datetime_in_utc().isoformat() | ||||
synth_props = { | synth_props = { | ||||
"orig_message": orig_message, | "orig_message": orig_message, | ||||
"log_message_id": log_message_id, | "log_message_id": log_message_id, | ||||
"log_timestamp": log_timestamp, | "log_timestamp": log_timestamp, | ||||
"run_id": self.run_id, | "run_id": self.run_id, | ||||
} | } | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |