zabgrab.cli.fetch¶
zabgrab fetch: downloading data.
Functions
|
Check before writing a lot of text to a .mat file. |
|
Warn about skipped items and report failed ones. |
|
Download the data for a plan's jobs, then close its connections. |
|
Write fetched data to a file. |
- async zabgrab.cli.fetch.run_plan(app, plan, query, *, dry_run, empty)[source]¶
Download the data for a plan’s jobs, then close its connections.
- Parameters:
app (AppContext) – For the UI and the clock.
plan (Plan) – The items to download, and the connections to their servers.
query (Query) – The time range and settings.
dry_run (bool) – Show the items that would be downloaded instead.
empty (ZabgrabError) – The error to raise if there are no items.
- Returns:
FetchResult or None – The data, or
Nonefor a dry run.- Return type:
FetchResult | None
- zabgrab.cli.fetch.guard_text(app, target, result, query, allow)[source]¶
Check before writing a lot of text to a .mat file.
See
zabgrab.services.output.guard_large_text().- Parameters:
app (AppContext) – For the UI.
target (Target) – Where the data is to be saved.
result (FetchResult) – The data.
query (Query) – For the
mat_text_warn_entriessetting.allow (bool) –
--allow-large-text.
- Returns:
tuple of Target and FetchResult – Where to save, and what.
- Return type:
- zabgrab.cli.fetch.save_target(target, result, metadata, query, options)[source]¶
Write fetched data to a file.
- Parameters:
target (Target) – Where and how to save.
result (FetchResult) – The data.
metadata (dict) – The metadata to save with it.
query (Query) – The query, for its time range and timezone.
options (SaveOptions) –
--groupand--in-place, for appending.
- Returns:
str – A description of where the data went, for the summary.
- Return type:
- zabgrab.cli.fetch.report_problems(app, result)[source]¶
Warn about skipped items and report failed ones.
- Parameters:
app (AppContext) – For the UI.
result (FetchResult) – The fetched data.
- Raises:
ZabgrabError – If nothing was fetched.
- Return type:
None