From 9061459f133bf825539ad394e9ab5eb81ebd2c49 Mon Sep 17 00:00:00 2001 From: Oleksandr Vayda Date: Thu, 10 Aug 2023 01:26:58 +0200 Subject: [PATCH] issue #28 Change the operation IDs type from string to integer --- src/spline_agent/harvester.py | 10 +++++----- src/spline_agent/lineage_model.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/spline_agent/harvester.py b/src/spline_agent/harvester.py index bc4200b..567e787 100644 --- a/src/spline_agent/harvester.py +++ b/src/spline_agent/harvester.py @@ -40,8 +40,8 @@ def harvest_lineage( cur_time = current_time() write_operation = WriteOperation( - id='op-0', - childIds=('op-1',), + id=0, + childIds=(1,), name='Write', # todo: put something more meaningful here, maybe 'write to {ds.type}' (issue #15) outputSource=ctx.output.url, append=ctx.write_mode == WriteMode.APPEND, @@ -49,7 +49,7 @@ def harvest_lineage( read_operations = tuple( ReadOperation( - id=f'op-{i + 2}', + id=i + 2, inputSources=(inp.url,), name='Read', # todo: put something more meaningful here, maybe 'read from {ds.type}' (issue #15) ) for i, inp in zip(range(len(ctx.inputs)), ctx.inputs)) @@ -102,8 +102,8 @@ def _process_func(ctx: LineageTrackingContext, func: Callable) -> tuple[DataOper file_name = inspect.getfile(func) operation = DataOperation( - id='op-1', - childIds=tuple(f'op-{i + 2}' for i in range(len(ctx.inputs))), + id=1, + childIds=tuple(i + 2 for i in range(len(ctx.inputs))), name='Python script', extra={ 'function_name': func_name, diff --git a/src/spline_agent/lineage_model.py b/src/spline_agent/lineage_model.py index 30827f8..0d83ee6 100644 --- a/src/spline_agent/lineage_model.py +++ b/src/spline_agent/lineage_model.py @@ -23,7 +23,7 @@ DurationNs = int # Represents an execution plan operation ID as string, e.g. 'op-123' -OperationId = str +OperationId = int @dataclass