Skip to content

Commit

Permalink
BUG: Add System information to Tracklog event
Browse files Browse the repository at this point in the history
  • Loading branch information
JB Lovland committed Jan 30, 2024
1 parent 55a4eaf commit 6e18501
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/fmu/dataio/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def generate_meta_tracklog() -> list[dict]:
dtime = datetime.datetime.now(timezone.utc).isoformat()
user = getpass.getuser()
sysinfo = {
"fmu-dataio": {"version": dataio.__version__},
"fmu-dataio": {
"version": dataio.__version__,
},
}
_kmd = read_named_envvar("KOMODO_RELEASE")
if _kmd is not None:
Expand Down
18 changes: 17 additions & 1 deletion src/fmu/dataio/datastructure/meta/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,19 @@ class Masterdata(BaseModel):
smda: Smda


class VersionInformation(BaseModel):
version: str


class SystemInformation(BaseModel):
fmu_dataio: Optional[VersionInformation] = Field(
alias="fmu-dataio", default=None, examples=["1.2.3"]
)
komodo: Optional[VersionInformation] = Field(
alias="fmu-dataio", default=None, examples=["2023.12.05-py38"]
)


class TracklogEvent(BaseModel):
# TODO: Update ex. to inc. timezone
# update NaiveDatetime -> AwareDatetime
Expand All @@ -259,9 +272,12 @@ class TracklogEvent(BaseModel):
examples=["2020-10-28T14:28:02"],
)
event: str = Field(
examples=["created", "updated"],
examples=["created", "updated", "merged"],
)
user: User
sysinfo: Optional[SystemInformation] = Field(
default=None,
)


class FMU(BaseModel):
Expand Down

0 comments on commit 6e18501

Please sign in to comment.