Log text
You can log different types of text to an attribute of a run.
Log a single string
To log a single string, use the log_configs()
function:
from neptune_scale import Run
with Run(...) as run:
run.log_configs({"my_text": "Text I keep track of, like query or tokenized word"})
The resulting attribute type is String
.
Log a series of strings
To log a series of strings to a single attribute, use the log_string_series()
function:
from neptune_scale import Run
with Run(...) as run:
run.log_string_series(
data={"messages/errors": "Job failed", "messages/info": "Training completed"},
step=1.2,
)
The resulting attribute type is StringSeries
.
Set the step value
To specify the index of the logged message, use the step
parameter:
run.log_string_series(
files={"message/errors": "Job failed"},
step=2,
)
Note that within a particular attribute path, the step values must increase.
Set custom timestamp
To provide a custom timestamp, pass a Python datetime value to the timestamp
argument:
run.log_string_series(
data=...,
step=...,
timestamp=datetime.utcnow(),
)
If the timestamp
argument isn't provided, the current time is used.
If timestamp.tzinfo
is not set, the time is assumed to be in the local timezone.
Analyze string series in the app
To view the logged string series in the Neptune app, you can do the following:
- In the runs table, add a
StringSeries
attribute as a column. Note that only the last entry is displayed. - In the Attributes tab of a selected run, access and view the entire string series.
- In dashboards and reports, configure a logs widget.
Log a text file
For details on uploading files, see Log files.