Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump selected sysinfo to tracklog. #424

Merged

Conversation

perolavsvendsen
Copy link
Member

@perolavsvendsen perolavsvendsen commented Jan 19, 2024

Solve #387

This PR includes some selected system information to the tracklog created entry when exporting data with fmu-dataio. The selected information include the current version of fmu-dataio used and the Komodo release when running in a Komodo environment.

The purpose of this is to ease debugging and user support, i.e. "as a developer I would like to know which version of fmu-dataio was used, so that I can understand the users context, detect and solve problems quicker."

Put into metadata the answer to the most common first debugging question: "Which version of fmu-dataio is the user running?"

Updated tracklog entry in produced metadata:

tracklog:
  - datetime: 2020-10-28T14:28:02
    user:
      id: peesv
    event: created
    sysinfo:   # New ⚡
      fmu-dataio:
        version: 1.2.3
      komodo: # only added when running in Komodo environment
        release: 2023.12.05-py38
  - datetime: 2020-10-28T14:46:14
    user: 
      id: peesv
    event: updated

@perolavsvendsen
Copy link
Member Author

perolavsvendsen commented Jan 19, 2024

  • May be annoying with changes while ongoing work on schema etc @janbjorge
  • Is this useful?
  • Is the reading of environment variables robust? Is it best (good enough) practice? On thin ice.

@perolavsvendsen perolavsvendsen marked this pull request as ready for review January 19, 2024 07:31
@roywilly
Copy link

Excellent idea, looking good to me. How can I test it end-to-end? Install this branch of fmu_dataio in a komodo environment, but how do I test the schema version? @perolavsvendsen

@perolavsvendsen
Copy link
Member Author

Excellent idea, looking good to me. How can I test it end-to-end? Install this branch of fmu_dataio in a komodo environment, but how do I test the schema version? @perolavsvendsen

End-to-end testing would be perfect 👍

Not entirely sure if we can test the schema as part of that. But we do test the current examples in unit tests. So if the produced metadata "in the wild" is 1:1 with the example, that should confirm that all is good.

It is also possible to validate produced metadata directly on the local (new) schema, using e.g. python validator. An old draft which includes a validator here which may be useful to look at. (But I think just confirming manually against the examples should be sufficient.)

Comment on lines +364 to +368
def read_named_envvar(envvar: str) -> str | None:
"""Read a specific (named) environment variable."""
return os.environ.get(envvar, None)


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a separate routine for this? (unless we want to make more checks etc, then the oneliner os.environ.get() will do)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly not, but it made some sense to me to have a dedicated unit test on it. But I made that decision before I knew it would become just 1 line...

Copy link
Collaborator

@jcrivenaes jcrivenaes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Possibly also add operating system info and host ID?

@perolavsvendsen
Copy link
Member Author

LGTM. Possibly also add operating system info and host ID?

Added to the issue, sounds like a good second wave if the first works

@perolavsvendsen perolavsvendsen merged commit c1f8ae6 into equinor:main Jan 19, 2024
12 checks passed
@perolavsvendsen perolavsvendsen deleted the 387-system-information branch January 19, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants