-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
refactor(ingest): defer ctx.graph initialization #10504
Changes from all commits
a7ec553
566c1de
7306212
0214ae1
5036500
00c6695
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,36 +79,33 @@ def create( | |
cls, | ||
config_dict: Dict[str, Any], | ||
ctx: PipelineContext, | ||
sink: Sink, | ||
) -> PipelineRunListener: | ||
sink_config_holder: Optional[DynamicTypedConfig] = None | ||
|
||
reporter_config = DatahubIngestionRunSummaryProviderConfig.parse_obj( | ||
config_dict or {} | ||
) | ||
if reporter_config.sink: | ||
sink_config_holder = reporter_config.sink | ||
|
||
if sink_config_holder is None: | ||
# Populate sink from global recipe | ||
assert ctx.pipeline_config | ||
sink_config_holder = ctx.pipeline_config.sink | ||
# Global instances are safe to use only if the types are datahub-rest and datahub-kafka | ||
# Re-using a shared file sink will result in clobbering the events | ||
if sink_config_holder.type not in ["datahub-rest", "datahub-kafka"]: | ||
sink_class = sink_registry.get(reporter_config.sink.type) | ||
sink_config = reporter_config.sink.config or {} | ||
sink = sink_class.create(sink_config, ctx) | ||
else: | ||
if not isinstance( | ||
sink, | ||
tuple( | ||
[ | ||
kls | ||
for kls in [ | ||
sink_registry.get_optional("datahub-rest"), | ||
sink_registry.get_optional("datahub-kafka"), | ||
] | ||
if kls | ||
] | ||
), | ||
): | ||
raise IgnorableError( | ||
f"Datahub ingestion reporter will be disabled because sink type {sink_config_holder.type} is not supported" | ||
f"Datahub ingestion reporter will be disabled because sink type {type(sink)} is not supported" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks a bit weird we use a hardwired list for this, and not the sink has some property which can tell if it supports reporter or not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I don't really like the way this is set up either, but don't want to boil the ocean right now |
||
) | ||
|
||
sink_type = sink_config_holder.type | ||
sink_class = sink_registry.get(sink_type) | ||
sink_config = sink_config_holder.dict().get("config") or {} | ||
if sink_type == "datahub-rest": | ||
# for the rest emitter we want to use sync mode to emit | ||
# regardless of the default sink config since that makes it | ||
# immune to process shutdown related failures | ||
sink_config["mode"] = "SYNC" | ||
|
||
sink: Sink = sink_class.create(sink_config, ctx) | ||
return cls(sink, reporter_config.report_recipe, ctx) | ||
|
||
def __init__(self, sink: Sink, report_recipe: bool, ctx: PipelineContext) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a nicer way to get None instead of a silently caught exception?
Do we care about the exception or is it fine to drop silently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, we don't care about the exception