Skip to content

Commit

Permalink
Adds diagnostic whoami flow
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilRex committed Dec 6, 2024
1 parent 3bacb7b commit f92efc2
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions flows/whoami.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
This flow will log information about the current environment. Use it to
diagnose issues with your environment, especially when deploying to
infrastructure.
"""

import sys
import os
import platform
import socket

import httpx
import prefect


@prefect.flow
def whoami():
logger = prefect.get_run_logger()

data = {
"Platform": platform.machine(),
"OS": platform.version(),
"Python": sys.version,
"Prefect": prefect.__version__,
"Hostname": socket.gethostname(),
"Address": httpx.get("https://api.ipify.org").text,
"User": os.getenv("USER"),
"CWD": os.getcwd(),
"CPUs": os.cpu_count(),
"PID": os.getpid(),
"UID": os.getuid(),
}

for key, value in data.items():
logger.info(f"{key}: {value}")


if __name__ == "__main__":
whoami()

0 comments on commit f92efc2

Please sign in to comment.