outputbundle package¶
Module contents¶
Read/write arkimaps output bundles.
An output bundle is a zip or tar file with the output products of an arkimaps run, and their associated metadata.
The main entry points for reading an output bundle are ZipReader
and
TarReader
.
Example program to show all products in a zip bundle:
#!/usr/bin/python3
import json
import sys
from arkimapslib.outputbundle import ZipReader
reader = ZipReader(sys.argv[1])
products = reader.products()
for path, info in products.by_path.items():
georef = info.georef
recipe_info = products.by_recipe[info.recipe]
legend_info = recipe_info.legend_info
print(json.dumps({"path": path, "georef": georef, "legend": legend_info}, indent=1))
- class arkimapslib.outputbundle.InputProcessingStats[source]¶
Statistics collected while processing inputs
- add_computation_log(elapsed: int, what: str) None [source]¶
Add an entry to the computation log.
- Parameters:
elapsed – elapsed time in nanoseconds
what – description of the computation
- computation_log: List[Tuple[int, str]]¶
List of strings describing computation steps, and the time they took in nanoseconds
- classmethod from_jsonable(data: Dict[str, Any])[source]¶
Recreate an object serialized by to_jsonable
- used_by: Set[str]¶
List of recipes that used this input to generate products
- class arkimapslib.outputbundle.InputSummary[source]¶
Summary about inputs useed in processing
- classmethod from_jsonable(data: Dict[str, Any])[source]¶
Recreate an object serialized by to_jsonable
- inputs: Dict[str, InputProcessingStats]¶
Per-input processing information indexed by input name
- class arkimapslib.outputbundle.Log[source]¶
A collection of log entries.
Iterate
Log.entries
for a list of all log entries generated during processing.
- class arkimapslib.outputbundle.LogEntry(ts: float, level: int, msg: str, name: str)[source]¶
One serializable log entry
- level: int¶
Log level
- msg: str¶
Log message
- name: str¶
Logger name
- ts: float¶
Timestamp in seconds
- class arkimapslib.outputbundle.ProductInfo(*, recipe: Optional[str] = None, reftime: Optional[datetime] = None, step: Optional[ModelStep] = None, georef: Optional[Dict[str, Any]] = None)[source]¶
Information about a generated product image
- classmethod from_jsonable(data: Dict[str, Any])[source]¶
Recreate an object serialized by to_jsonable
- georef: Dict[str, Any]¶
Georeferencing information
- recipe: Optional[str]¶
Name of the recipe used for this product
- reftime: Optional[datetime]¶
Reference time
- step: Optional[ModelStep]¶
Step
- class arkimapslib.outputbundle.Products[source]¶
Information about the products present in the bundle
- by_path: Dict[str, ProductInfo]¶
Products generated, indexed by their path
- by_recipe: Dict[str, RecipeOrders]¶
Recipes used, indexed by name
- flavour: Optional[Dict[str, Any]]¶
Information about the flavour used
- class arkimapslib.outputbundle.Reader[source]¶
Read functions for output bundles
- input_summary() InputSummary [source]¶
Return summary of all inputs used during processing
- abstract load_artifact(bundle_path: str) bytes [source]¶
Load processing artifact.
Return the raw file data
- class arkimapslib.outputbundle.RecipeOrders[source]¶
Information and statistics for all orders generated from one recipe
- by_reftime: Dict[datetime, ReftimeOrders]¶
Summary of all products produced for this recipe at this reference time
- classmethod from_jsonable(data: Dict[str, Any])[source]¶
Recreate an object serialized by to_jsonable
- legend_info: Optional[Dict[str, Any]]¶
Legend information for products produced from this recipe
- class arkimapslib.outputbundle.ReftimeOrders(*, inputs: Optional[Sequence[str]] = None, steps: Optional[Dict[ModelStep, int]] = None, render_time_ns: int = 0)[source]¶
Information and statistics for all orders for a given reftime
- classmethod from_jsonable(data: Dict[str, Any]) ReftimeOrders [source]¶
Recreate an object serialized by to_jsonable
- inputs: Set[str]¶
Names of inputs used
- render_time_ns: int¶
Total processing time in nanoseconds
- steps: Dict[ModelStep, int]¶
Numer of products produced for each step
- class arkimapslib.outputbundle.Serializable[source]¶
Base for classes that can be serialized to JSON
- class arkimapslib.outputbundle.TarReader(path: Path)[source]¶
Read an output bundle from a tar file
Usage:
with TarReader(path) as reader: for name in reader.find(): if name.endswith(".png"): print(name)
See
Reader
for the full method list
- class arkimapslib.outputbundle.TarWriter(out: IO[bytes])[source]¶
Write an output bundle as a tar file.
- class arkimapslib.outputbundle.Writer[source]¶
Write functions for output bundles
- add_input_summary(input_summary: InputSummary)[source]¶
Add inputs.json with a summary of inputs used
- class arkimapslib.outputbundle.ZipReader(path: Path)[source]¶
Read an output bundle from a zip file
Usage:
with ZipReader(path) as reader: for name in reader.find(): if name.endswith(".png"): print(name)
See
Reader
for the full method list