Log the command used to execute the script#
When executing a script through the command line, you can use the Python sys module to log the command.
Add the following to the Python script where a Neptune run is initialized:
import sys
import neptune
run = neptune.init_run()
run["execution_command"] = f"python {sys.argv[0]} {' '.join(sys.argv[1:])}"
The above example uses sys.argv to parse the command line arguments and add them to the execution command and script name. The resulting string is then logged to Neptune.
Now, if you use the following command to execute the script:
the entire command is logged under a String
field named execution_command
.
Related