Skip to content

Commit

Permalink
Basic sync flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Raalsky committed Jul 17, 2024
1 parent 6ec65ce commit 0884a3f
Show file tree
Hide file tree
Showing 33 changed files with 187 additions and 750 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

### Features
- Added auto-generation of `custom_run_id` if it's not provided ([#1762](https://github.com/neptune-ai/neptune-client/pull/1762))
- Added support for `sync` mode ([#1835](https://github.com/neptune-ai/neptune-client/pull/1835))

### Changes
- Stop sending `X-Neptune-LegacyClient` header ([#1715](https://github.com/neptune-ai/neptune-client/pull/1715))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ websocket-client = ">=0.35.0, !=1.0.0"
urllib3 = "*"
swagger-spec-validator = ">=2.7.4"
protobuf = "^4.0.0"
neptune-api = "0.2.0"
neptune-api = "0.3.0"

# Built-in integrations
psutil = "*"
Expand Down
44 changes: 12 additions & 32 deletions src/neptune/api/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@
Optional,
)

import neptune_api.proto.neptune_pb.ingest.v1.common_pb2 as common_pb2
import neptune_api.proto.neptune_pb.ingest.v1.pub.ingest_pb2 as ingest_pb2
from google.protobuf import timestamp_pb2

import neptune.api.proto.neptune_pb.ingest.v1.common_pb2 as common_pb2
import neptune.api.proto.neptune_pb.ingest.v1.pub.ingest_pb2 as ingest_pb2


class Serializable(abc.ABC):
@abc.abstractmethod
Expand All @@ -59,8 +58,9 @@ def to_proto(self, run_op: "RunOperation") -> ingest_pb2.RunOperation:
create=common_pb2.Run(
creation_time=timestamp_pb2.Timestamp(seconds=int(self.created_at.timestamp())),
run_id=self.custom_id,
experiment_id=self.custom_id,
family=self.custom_id,
),
api_key=b"",
)


Expand Down Expand Up @@ -90,13 +90,9 @@ def to_proto(self, run_op: "RunOperation") -> ingest_pb2.RunOperation:
run_id=run_op.run_id,
update=common_pb2.UpdateRunSnapshot(
step=step,
append={
"path": common_pb2.Value(string=self.path),
"value": common_pb2.Value(float64=first_item.value),
},
append={f"{self.path}": common_pb2.Value(float64=first_item.value)},
timestamp=timestamp_pb2.Timestamp(seconds=int(first_item.timestamp)),
),
api_key=b"",
)


Expand All @@ -110,12 +106,8 @@ def to_proto(self, run_op: "RunOperation") -> ingest_pb2.RunOperation:
project=run_op.project,
run_id=run_op.run_id,
update=common_pb2.UpdateRunSnapshot(
assign={
"path": common_pb2.Value(string=self.path),
"value": common_pb2.Value(int64=self.value),
},
assign={f"{self.path}": common_pb2.Value(int64=self.value)},
),
api_key=b"",
)


Expand All @@ -129,12 +121,8 @@ def to_proto(self, run_op: "RunOperation") -> ingest_pb2.RunOperation:
project=run_op.project,
run_id=run_op.run_id,
update=common_pb2.UpdateRunSnapshot(
assign={
"path": common_pb2.Value(string=self.path),
"value": common_pb2.Value(float64=self.value),
},
assign={f"{self.path}": common_pb2.Value(float64=self.value)},
),
api_key=b"",
)


Expand All @@ -148,12 +136,8 @@ def to_proto(self, run_op: "RunOperation") -> ingest_pb2.RunOperation:
project=run_op.project,
run_id=run_op.run_id,
update=common_pb2.UpdateRunSnapshot(
assign={
"path": common_pb2.Value(string=self.path),
"value": common_pb2.Value(bool=self.value),
},
assign={f"{self.path}": common_pb2.Value(bool=self.value)},
),
api_key=b"",
)


Expand All @@ -167,12 +151,8 @@ def to_proto(self, run_op: "RunOperation") -> ingest_pb2.RunOperation:
project=run_op.project,
run_id=run_op.run_id,
update=common_pb2.UpdateRunSnapshot(
assign={
"path": common_pb2.Value(string=self.path),
"value": common_pb2.Value(string=self.value),
},
assign={f"{self.path}": common_pb2.Value(string=self.value)},
),
api_key=b"",
)


Expand All @@ -187,11 +167,11 @@ def to_proto(self, run_op: "RunOperation") -> ingest_pb2.RunOperation:
run_id=run_op.run_id,
update=common_pb2.UpdateRunSnapshot(
assign={
"path": common_pb2.Value(string=self.path),
"value": common_pb2.Value(timestamp=timestamp_pb2.Timestamp(seconds=int(self.value.timestamp()))),
f"{self.path}": common_pb2.Value(
timestamp=timestamp_pb2.Timestamp(seconds=int(self.value.timestamp()))
)
},
),
api_key=b"",
)


Expand Down
Empty file.
Empty file.
59 changes: 0 additions & 59 deletions src/neptune/api/proto/neptune_pb/ingest/v1/common_pb2.py

This file was deleted.

Loading

0 comments on commit 0884a3f

Please sign in to comment.