-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |