Skip to content

Commit

Permalink
Fix types.proto and test_events.py (dbt-labs#6947)
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank authored Feb 10, 2023
1 parent 250537b commit f1087e5
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 136 deletions.
64 changes: 44 additions & 20 deletions core/dbt/events/proto_types.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 9 additions & 101 deletions core/dbt/events/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -349,53 +349,6 @@ message InternalDeprecationMsg {
InternalDeprecation data = 2;
}

// D - Deprecation

// D001
message PackageRedirectDeprecation {
EventInfo info = 1;
string old_name = 2;
string new_name = 3;
}

// D002
message PackageInstallPathDeprecation {
EventInfo info = 1;
}

// D003
message ConfigSourcePathDeprecation {
EventInfo info = 1;
string deprecated_path = 2;
string exp_path = 3;
}

// D004
message ConfigDataPathDeprecation {
EventInfo info = 1;
string deprecated_path = 2;
string exp_path = 3;
}

//D005
message AdapterDeprecationWarning {
EventInfo info = 1;
string old_name = 2;
string new_name = 3;
}

//D006
message MetricAttributesRenamed {
EventInfo info = 1;
string metric_name = 2;
}

//D007
message ExposureNameDeprecation {
EventInfo info = 1;
string exposure = 2;
}

// E - DB Adapter

// E001
Expand Down Expand Up @@ -807,22 +760,20 @@ message FinishedRunningStatsMsg {
FinishedRunningStats data = 2;
}


// I - Project parsing

// I001
message ParseCmdOut {
string msg = 1;
// Skipping I001, I002, I003, I004, I005, I006, I007, I008, I009

// I010
message ParsePerfInfoPath {
string path = 1;
}

message ParseCmdOutMsg {
message ParsePerfInfoPathMsg {
EventInfo info = 1;
ParseCmdOut data = 2;
ParsePerfInfoPath data = 2;
}

// Skipping I002, I003, I004, I005, I006, I007, I008, I009, I010


// I011
message GenericTestFileParse {
string path = 1;
Expand Down Expand Up @@ -1405,19 +1356,6 @@ message NoNodesForSelectionCriteriaMsg {
NoNodesForSelectionCriteria data = 2;
}

// M029
message DepsUnpinned {
EventInfo info = 1;
string revision = 2;
string git = 3;
}

// M030
message NoNodesForSelectionCriteria {
EventInfo info = 1;
string spec_raw = 2;
}

// Q - Node execution

// Q001
Expand Down Expand Up @@ -1545,8 +1483,8 @@ message LogSeedResult {
int32 index = 4;
int32 total = 5;
float execution_time = 6;
string source_name = 7;
string table_name = 8;
string schema = 7;
string relation = 8;
}

message LogSeedResultMsg {
Expand All @@ -1556,13 +1494,6 @@ message LogSeedResultMsg {

// Skipped Q017

message LogSeedResultMsg {
EventInfo info = 1;
LogSeedResult data = 2;
}

// Skipped Q017

// Q018
message LogFreshnessResult {
string status = 1;
Expand Down Expand Up @@ -1726,24 +1657,6 @@ message NothingToDo {
}

message NothingToDoMsg {
NodeInfo node_info = 1;
string resource_type = 2;
string schema = 3;
string node_name = 4;
int32 index = 5;
int32 total = 6;
}

message SkippingDetailsMsg {
NodeInfo node_info = 1;
string resource_type = 2;
string schema = 3;
string node_name = 4;
int32 index = 5;
int32 total = 6;
}

message SkippingDetailsMsg {
EventInfo info = 1;
NothingToDo data = 2;
}
Expand Down Expand Up @@ -1780,11 +1693,6 @@ message NoNodesSelectedMsg {
NoNodesSelected data = 2;
}

// Q038
message NoNodesSelected {
EventInfo info = 1;
}

// W - Node testing

// Skipped W001
Expand Down
13 changes: 2 additions & 11 deletions core/dbt/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,20 +768,11 @@ def message(self) -> str:
# =======================================================


@dataclass
class ParseCmdOut(InfoLevel, pt.ParseCmdOut):
def code(self):
return "I001"

def message(self) -> str:
return self.msg


# Skipping I002, I003, I004, I005, I006, I007, I008, I009
# Skipping I001, I002, I003, I004, I005, I006, I007, I008, I009


@dataclass
class ParseCmdPerfInfoPath(InfoLevel, pt.ParseCmdPerfInfoPath):
class ParsePerfInfoPath(InfoLevel, pt.ParsePerfInfoPath):
def code(self):
return "I010"

Expand Down
4 changes: 2 additions & 2 deletions core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from dbt.events.types import (
PartialParsingErrorProcessingFile,
PartialParsingError,
ParseCmdPerfInfoPath,
ParsePerfInfoPath,
PartialParsingSkipParsing,
UnableToPartialParse,
PartialParsingNotEnabled,
Expand Down Expand Up @@ -989,7 +989,7 @@ def process_nodes(self):
def write_perf_info(self, target_path: str):
path = os.path.join(target_path, PERF_INFO_FILE_NAME)
write_file(path, json.dumps(self._perf_info, cls=dbt.utils.JSONEncoder, indent=4))
fire_event(ParseCmdPerfInfoPath(path=path))
fire_event(ParsePerfInfoPath(path=path))


def invalid_target_fail_unless_test(
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
msg_from_base_event,
)
from dbt.events.functions import msg_to_dict, msg_to_json
from dbt.flags import set_from_args
from argparse import Namespace


# takes in a class and finds any subclasses for it
Expand Down Expand Up @@ -170,8 +172,7 @@ def test_event_codes(self):
types.HooksRunning(num_hooks=0, hook_type=""),
types.FinishedRunningStats(stat_line="", execution="", execution_time=0),
# I - Project parsing ======================
types.ParseCmdOut(msg="testing"),
types.ParseCmdPerfInfoPath(path=""),
types.ParsePerfInfoPath(path=""),
types.GenericTestFileParse(path=""),
types.MacroFileParse(path=""),
types.PartialParsingErrorProcessingFile(file=""),
Expand Down Expand Up @@ -385,6 +386,7 @@ class TestEventJSONSerialization:
# event types that take `Any` are not possible to test in this way since some will serialize
# just fine and others won't.
def test_all_serializable(self):
set_from_args(Namespace(WARN_ERROR=False), None)
all_non_abstract_events = set(
get_all_subclasses(BaseEvent),
)
Expand Down

0 comments on commit f1087e5

Please sign in to comment.