utilities.profiler

client.utilities.profiler

Classes

Name Description
Profiler A context manager–based profiler to log events and CPU and memory usage

Profiler

client.utilities.profiler.Profiler(
    array_uri=None,
    group_uri=None,
    group_member=None,
    id=None,
    period_sec=5,
    trace=False,
)

A context manager–based profiler to log events and CPU and memory usage to a TileDB array.

If the trace parameter is True, CPU and memory usage will be logged to the array every period_sec seconds. This is useful for profiling jobs that are OOM killed.

Examples:

# Basic usage
with Profiler(array_uri="tiledb://array-uri..."):
    # code to profile

# Write custom events
with Profiler(group_uri="tiledb://group-uri...", group_member="log") as prof:
    # code to profile

    # write custom event
    prof.write("my-op", "my-data", "my-extra-data")

    # more code to profile

Methods

Name Description
write Write an event to the log array.
write
client.utilities.profiler.Profiler.write(op='', data='', extra='')

Write an event to the log array.

When writing large amounts of data, store the data in the extra parameter to improve query performance when the extra data is not needed.

:param op: event op, defaults to “” :param data: event data, defaults to “” :param extra: event extra data, defaults to “”

Functions

Name Description
create_log_array Create an array to hold log events.
write_log_event Write an event to the log array.

create_log_array

client.utilities.profiler.create_log_array(uri)

Create an array to hold log events.

:param uri: array URI

write_log_event

client.utilities.profiler.write_log_event(uri, id, op='', data='', extra='')

Write an event to the log array.

When writing large amounts of data, store the data in the extra parameter to improve query performance when the extra data is not needed.

:param uri: array URI :param id: event id :param op: event operation, defaults to “” :param data: event data, defaults to “” :param extra: event extra data, defaults to “”