mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-01 19:25:56 +00:00
feat(ingestion): add ability to exclude archived mode reports. (#14978)
Co-authored-by: Tamas Nemeth <treff7es@gmail.com>
This commit is contained in:
parent
10c28be20c
commit
1934ed45e8
@ -214,6 +214,10 @@ class ModeConfig(
|
||||
description="Number of items per page for paginated API requests.",
|
||||
)
|
||||
|
||||
exclude_archived: bool = Field(
|
||||
default=False, description="Exclude archived reports"
|
||||
)
|
||||
|
||||
@validator("connect_uri")
|
||||
def remove_trailing_slash(cls, v):
|
||||
return config_clean.remove_trailing_slashes(v)
|
||||
@ -1473,6 +1477,15 @@ class ModeSource(StatefulIngestionSourceBase):
|
||||
logger.debug(
|
||||
f"Read {len(reports_page)} reports records from workspace {self.workspace_uri} space {space_token}"
|
||||
)
|
||||
if self.config.exclude_archived:
|
||||
logger.debug(
|
||||
f"Excluding archived reports since exclude_archived: {self.config.exclude_archived}"
|
||||
)
|
||||
reports_page = [
|
||||
report
|
||||
for report in reports_page
|
||||
if not report.get("archived", False)
|
||||
]
|
||||
yield reports_page
|
||||
except ModeRequestError as e:
|
||||
if isinstance(e, HTTPError) and e.response.status_code == 404:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user