code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def get_client_class(self) -> Type[client.BaseMessagingServiceClient]:
"""Gets the client class registered.
Returns:
A BaseMessagingServiceClient class.
Raises:
Exception: No client class has been registered.
"""
if self.client_cls is None:
raise Exception('No client class has be... | Gets the client class registered.
Returns:
A BaseMessagingServiceClient class.
Raises:
Exception: No client class has been registered.
| get_client_class | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | Apache-2.0 |
def get_runner_class(self) -> Type[runners.BaseRunner]:
"""Gets the BaseRunner class registered.
Returns:
A BaseRunner class.
"""
try:
if (
_STREAMING_PULL.value
and _BENCHMARK_SCENARIO.value == END_TO_END_LATENCY
):
return self.runner_registry[STREAMING_PU... | Gets the BaseRunner class registered.
Returns:
A BaseRunner class.
| get_runner_class | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | Apache-2.0 |
def register_client(
self, client_cls: Type[client.BaseMessagingServiceClient]
):
"""Registers a client class to create instances with.
Args:
client_cls: The client class to register.
"""
self.client_cls = client_cls | Registers a client class to create instances with.
Args:
client_cls: The client class to register.
| register_client | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | Apache-2.0 |
def _register_runners(self):
"""Registers all runner classes to create instances depending on flags."""
self._register_runner(PUBLISH_LATENCY, runners.PublishLatencyRunner)
self._register_runner(PULL_LATENCY, runners.PullLatencyRunner)
self._register_runner(
END_TO_END_LATENCY, latency_runner.En... | Registers all runner classes to create instances depending on flags. | _register_runners | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/app.py | Apache-2.0 |
def generate_message(self, seq: int, message_size: int) -> str:
"""Generates a message str.
This message consists of 2 parts: a 6 chars-long space padded base64 encoded
representation of an unsigned 32-bit integer (the sequence number), and then
ASCII spaces for padding.
Args:
seq: The seque... | Generates a message str.
This message consists of 2 parts: a 6 chars-long space padded base64 encoded
representation of an unsigned 32-bit integer (the sequence number), and then
ASCII spaces for padding.
Args:
seq: The sequence number. Must be an unsigned 32-bit integer.
message_size: The... | generate_message | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | Apache-2.0 |
def decode_seq_from_message(self, message: Any) -> int:
"""Gets the seq number from the str contents of a message.
The contents of the message should follow the format used in the output of
generate_message.
Args:
message: The message as returned by pull_message.
Returns:
An int. The ... | Gets the seq number from the str contents of a message.
The contents of the message should follow the format used in the output of
generate_message.
Args:
message: The message as returned by pull_message.
Returns:
An int. The message sequence number.
| decode_seq_from_message | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | Apache-2.0 |
def from_flags(
cls: Type[BaseMessagingServiceClientT],
) -> BaseMessagingServiceClientT:
"""Gets an actual instance based upon the FLAGS values."""
pass | Gets an actual instance based upon the FLAGS values. | from_flags | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | Apache-2.0 |
def publish_message(self, message_payload: str) -> Any:
"""Publishes a single message to the messaging service.
Args:
message_payload: Message, created by 'generate_message'. This message will
be the one that we publish/pull from the messaging service.
Returns:
Return response to publi... | Publishes a single message to the messaging service.
Args:
message_payload: Message, created by 'generate_message'. This message will
be the one that we publish/pull from the messaging service.
Returns:
Return response to publish a message from the provider. For GCP PubSub
we make a ... | publish_message | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | Apache-2.0 |
def pull_message(self, timeout: float = TIMEOUT) -> Any:
"""Pulls a single message from the messaging service.
Args:
timeout: The number of seconds to wait before timing out.
Returns:
Return response to pull a message from the provider. For GCP PubSub
we make a call to '.pull' that pulls... | Pulls a single message from the messaging service.
Args:
timeout: The number of seconds to wait before timing out.
Returns:
Return response to pull a message from the provider. For GCP PubSub
we make a call to '.pull' that pulls a message and we return
the result from this call. If it ... | pull_message | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | Apache-2.0 |
def acknowledge_received_message(self, response: Any):
"""Acknowledge that the pulled message was received.
It tries to acknowledge the message that was pulled with _pull_message.
Args:
response: Response from _pull_message.
""" | Acknowledge that the pulled message was received.
It tries to acknowledge the message that was pulled with _pull_message.
Args:
response: Response from _pull_message.
| acknowledge_received_message | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | Apache-2.0 |
def close(self):
"""Closes the underlying client objects.
Optional override. By default it does nothing.
""" | Closes the underlying client objects.
Optional override. By default it does nothing.
| close | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/client.py | Apache-2.0 |
def get_logger(name, log_file):
"""Gets a new logger that outputs to a file."""
if not _DEBUG.value:
return logging.getLogger('')
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter(_LOG_FORMAT)
fh = logging.FileHandler(log_file)
fh.setFormatter(formatter)
l... | Gets a new logger that outputs to a file. | get_logger | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/log_utils.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/log_utils.py | Apache-2.0 |
def run_class_startup(cls):
"""Requests to run the class startup code if it hasn't run yet.
Do not override this. Instead override the on_startup method.
"""
if not cls.STARTUP_RUN:
cls.on_startup()
cls.STARTUP_RUN = True | Requests to run the class startup code if it hasn't run yet.
Do not override this. Instead override the on_startup method.
| run_class_startup | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | Apache-2.0 |
def _get_summary_statistics(
self,
scenario: str,
results: List[float],
number_of_messages: int,
failure_counter: int,
) -> Dict[str, Any]:
"""Getting statistics based on results from the benchmark."""
metrics_data = {}
common_metadata = {}
latency_mean = np.mean(results... | Getting statistics based on results from the benchmark. | _get_summary_statistics | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | Apache-2.0 |
def run_phase(
self, number_of_messages: int, message_size: int
) -> Dict[str, Any]:
"""Runs a given benchmark based on the benchmark_messaging_service Flag.
Args:
number_of_messages: Number of messages to use on the benchmark.
message_size: Size of the messages that will be used on the ben... | Runs a given benchmark based on the benchmark_messaging_service Flag.
Args:
number_of_messages: Number of messages to use on the benchmark.
message_size: Size of the messages that will be used on the benchmark. It
specifies the number of characters in those messages.
Returns:
Diction... | run_phase | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | Apache-2.0 |
def run_phase(
self, number_of_messages: int, message_size: int
) -> Dict[str, Any]:
"""Pull messages from messaging service and measure single pull latency.
This function attempts to pull messages from a messaging service in a
single stream to compute and report average stats for a single message
... | Pull messages from messaging service and measure single pull latency.
This function attempts to pull messages from a messaging service in a
single stream to compute and report average stats for a single message
pull. It measures the latency between a call to pull the message, and the
message being succ... | run_phase | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | Apache-2.0 |
def run_phase(
self, number_of_messages: int, message_size: int
) -> Dict[str, Any]:
"""Publish messages on messaging service and measure single publish latency.
This function attempts to publish messages to a messaging service in a
single stream to compute and report average stats for a single mes... | Publish messages on messaging service and measure single publish latency.
This function attempts to publish messages to a messaging service in a
single stream to compute and report average stats for a single message
publish. It measures the latency between a call to publish the message, and
the message... | run_phase | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/runners.py | Apache-2.0 |
async def _async_run_phase(self, number_of_messages: int) -> Dict[str, Any]:
"""Actual coroutine implementing run phase logic.
Not re-entrant!
Args:
number_of_messages: Number of messages.
Returns:
A dict of metrics.
"""
self._publisher = main_process.PublisherWorker(self.PUBLISHE... | Actual coroutine implementing run phase logic.
Not re-entrant!
Args:
number_of_messages: Number of messages.
Returns:
A dict of metrics.
| _async_run_phase | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/latency_runner.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/latency_runner.py | Apache-2.0 |
async def start(self, timeout: Optional[float] = None):
"""Launches the subprocess then waits for a Ready message.
Args:
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
"""
self.subprocess = mp.Process(
target=self.subprocess_func,
kwargs={
'input_... | Launches the subprocess then waits for a Ready message.
Args:
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
| start | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | Apache-2.0 |
async def stop(self, timeout: Optional[float] = None):
"""Attempts to gracefully shutdown the subprocess, else just kills it.
Args:
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
"""
try:
self.subprocess.terminate()
await self._join_subprocess(timeout)
except... | Attempts to gracefully shutdown the subprocess, else just kills it.
Args:
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
| stop | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | Apache-2.0 |
async def _read_subprocess_output(
self, message_type: Type[Any], timeout: Optional[float] = None
):
"""Attempts to read the subprocess output with a timeout."""
timeout = self.DEFAULT_TIMEOUT if timeout is None else timeout
deadline = time.time() + timeout
while not self.subprocess_out_reader.p... | Attempts to read the subprocess output with a timeout. | _read_subprocess_output | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | Apache-2.0 |
async def publish(
self, seq: int, timeout: Optional[float] = None
) -> protocol.AckPublish:
"""Commands the worker to send a message.
Args:
seq: Sequence number. Must be an unsigned 32-bit integer.
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
Returns:
An ... | Commands the worker to send a message.
Args:
seq: Sequence number. Must be an unsigned 32-bit integer.
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
Returns:
An int representing the timestamp registered just after the worker sent
the message.
| publish | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | Apache-2.0 |
async def start_consumption(self, seq: int, timeout: Optional[float] = None):
"""Commands the worker to start polling.
Then waits for the worker's ACK.
You shouldn't assume the worker is already polling when the ACK is received.
It's only guaranteed the worker's ACK will be sent back just before polli... | Commands the worker to start polling.
Then waits for the worker's ACK.
You shouldn't assume the worker is already polling when the ACK is received.
It's only guaranteed the worker's ACK will be sent back just before polling.
To be safe you should wait an extra time.
Args:
seq: int. The expe... | start_consumption | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | Apache-2.0 |
async def receive(
self, timeout: Optional[float] = None
) -> protocol.ReceptionReport:
"""Awaits the worker to receive a message and returns reported timestamps.
Args:
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
Returns:
A tuple of ints timestamps in nanosecon... | Awaits the worker to receive a message and returns reported timestamps.
Args:
timeout: Timeout in seconds. Defaults to BaseWorker.DEFAULT_TIMEOUT.
Returns:
A tuple of ints timestamps in nanoseconds
(receive_timestamp, ack_timestamp)
| receive | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/main_process.py | Apache-2.0 |
def main(
input_conn: connection.Connection,
output_conn: connection.Connection,
serialized_flags: str,
app: Any,
iterations: Optional[int] = None,
pinned_cpus: Optional[Iterable[Any]] = None,
):
"""Runs the code for the publisher worker subprocess.
Intended to be called with the multiproce... | Runs the code for the publisher worker subprocess.
Intended to be called with the multiprocessing.Process stdlib function.
Args:
input_conn: A connection object created with multiprocessing.Pipe to read
data from the main process.
output_conn: A connection object created with multiprocessing.Pipe to... | main | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/publisher.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/publisher.py | Apache-2.0 |
def main(
cls,
input_conn: connection.Connection,
output_conn: connection.Connection,
serialized_flags: str,
app: Any,
iterations: Optional[int] = None,
pinned_cpus: Optional[Iterable[Any]] = None,
):
"""Runs the code for the receiver worker subprocess.
Intended to b... | Runs the code for the receiver worker subprocess.
Intended to be called with the multiprocessing.Process stdlib function.
Args:
input_conn: A connection object created with multiprocessing.Pipe to read
data from the main process.
output_conn: A connection object created with multiprocessin... | main | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/receiver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/receiver.py | Apache-2.0 |
def await_message_received(self) -> Optional[protocol.ReceptionReport]:
"""Awaits a message from the messaging service and gets a reception report.
The default implementation calls self.client.pull_message, and then
self.process_message to get the reception report, but this may be
overriden.
Retur... | Awaits a message from the messaging service and gets a reception report.
The default implementation calls self.client.pull_message, and then
self.process_message to get the reception report, but this may be
overriden.
Returns:
A ReceptionReport object.
| await_message_received | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/receiver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/receiver.py | Apache-2.0 |
def process_message(self, message: Any) -> protocol.ReceptionReport:
"""Record the reception time for a message, ACK it (recording its time).
This code should be thread-safe, as it might get run concurrently
in a secondary thread (in subclasses).
Args:
message: A message object, as gotten by the... | Record the reception time for a message, ACK it (recording its time).
This code should be thread-safe, as it might get run concurrently
in a secondary thread (in subclasses).
Args:
message: A message object, as gotten by the client.
Returns:
A ReceptionReport object with the decoded seq, ... | process_message | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/receiver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/receiver.py | Apache-2.0 |
def await_from_main(
self, obj_class: Type[Any], ack_obj: Optional[Any] = None
) -> Any:
"""Awaits an incoming object from the main process, then returns it.
Args:
obj_class: The class the incoming object should be (otherwise raise an
error).
ack_obj: Optional. If specified, this ob... | Awaits an incoming object from the main process, then returns it.
Args:
obj_class: The class the incoming object should be (otherwise raise an
error).
ack_obj: Optional. If specified, this object will be sent back to the main
process once an incoming object has been received.
Retur... | await_from_main | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/worker_utils.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/worker_utils.py | Apache-2.0 |
def peek(self) -> Any:
"""Peeks for an incoming object from the main process without blocking.
The peeked object may be peeked again until await_from_main next call, which
will return it and remove it from the queue for good.
Returns:
The peeked object (or None).
"""
if self._peeked is N... | Peeks for an incoming object from the main process without blocking.
The peeked object may be peeked again until await_from_main next call, which
will return it and remove it from the queue for good.
Returns:
The peeked object (or None).
| peek | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/worker_utils.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/worker_utils.py | Apache-2.0 |
def _recv(self) -> Any:
"""Receives an object and consumes it for good."""
result = self.input_conn.recv() if self._peeked is None else self._peeked
self._peeked = None
return result | Receives an object and consumes it for good. | _recv | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/worker_utils.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/common/e2e/worker_utils.py | Apache-2.0 |
def publish_message(self, message: bytes) -> str:
"""Publishes a single message to a PubSub topic."""
published_message = self.publisher.publish(self.topic_path, message)
message_id = published_message.result(timeout=client.TIMEOUT)
return message_id | Publishes a single message to a PubSub topic. | publish_message | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/gcp/gcp_pubsub_client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/gcp/gcp_pubsub_client.py | Apache-2.0 |
def _get_first_six_bytes_from_payload(
self, message: Union[types.ReceivedMessage, pubsub_message.Message]
) -> bytes:
"""Gets the first 6 bytes of a message (as returned by pull_message or PullingStream)."""
if isinstance(message, types.ReceivedMessage):
return typing.cast(types.ReceivedMessage, ... | Gets the first 6 bytes of a message (as returned by pull_message or PullingStream). | _get_first_six_bytes_from_payload | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/messaging_service_scripts/gcp/gcp_pubsub_client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/messaging_service_scripts/gcp/gcp_pubsub_client.py | Apache-2.0 |
def _StorageURI(self, bucket, object_name=None):
"""Return a storage_uri for the given resource.
Args:
bucket: the name of a bucket.
object_name: the name of an object, if given.
Returns:
A storage_uri. If object is given, the uri will be for the bucket-object
combination. If objec... | Return a storage_uri for the given resource.
Args:
bucket: the name of a bucket.
object_name: the name of an object, if given.
Returns:
A storage_uri. If object is given, the uri will be for the bucket-object
combination. If object is not given, the uri will be for the bucket.
| _StorageURI | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/gcs_boto.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/gcs_boto.py | Apache-2.0 |
def CleanupBucket(service):
"""Cleans-up EVERYTHING under a given bucket as specified by FLAGS.bucket.
Args:
service: the ObjectStorageServiceBase to use.
"""
objects_to_cleanup = service.ListObjects(FLAGS.bucket, prefix=None)
while len(objects_to_cleanup) > 0:
logging.info('Will delete %d objects.'... | Cleans-up EVERYTHING under a given bucket as specified by FLAGS.bucket.
Args:
service: the ObjectStorageServiceBase to use.
| CleanupBucket | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def GenerateWritePayload(size):
"""Generate random data for use with WriteObjectFromBuffer.
Args:
size: the amount of data needed, in bytes.
Returns:
A byte array of the length requested, filled with random data.
"""
payload_bytes = bytearray(size)
# don't use a for...range(100M), range(100M) wil... | Generate random data for use with WriteObjectFromBuffer.
Args:
size: the amount of data needed, in bytes.
Returns:
A byte array of the length requested, filled with random data.
| GenerateWritePayload | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def WriteObjects(
service,
bucket,
object_prefix,
count,
size,
objects_written,
latency_results=None,
bandwidth_results=None,
):
"""Write a number of objects to a storage service.
Args:
service: the ObjectStorageServiceBase object to use.
bucket: Name of the bucket to write ... | Write a number of objects to a storage service.
Args:
service: the ObjectStorageServiceBase object to use.
bucket: Name of the bucket to write to.
object_prefix: The prefix of names of objects to be written.
count: The total number of objects that need to be written.
size: The size of each object... | WriteObjects | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def ReadObjects(
service,
bucket,
objects_to_read,
latency_results=None,
bandwidth_results=None,
object_size=None,
start_times=None,
):
"""Read a bunch of objects.
Args:
service: the ObjectStorageServiceBase object to use.
bucket: Name of the bucket.
objects_to_read: A list ... | Read a bunch of objects.
Args:
service: the ObjectStorageServiceBase object to use.
bucket: Name of the bucket.
objects_to_read: A list of names of objects to read.
latency_results: An optional list to receive latency results.
bandwidth_results: An optional list to receive bandwidth results.
... | ReadObjects | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def DeleteObjectsConcurrently(
service, per_thread_objects_to_delete, per_thread_objects_deleted
):
"""Delete a bunch of objects concurrently.
Args:
service: the ObjectStorageServiceBase object to use.
per_thread_objects_to_delete: A 2-d list of objects to delete per thread.
per_thread_objects_dele... | Delete a bunch of objects concurrently.
Args:
service: the ObjectStorageServiceBase object to use.
per_thread_objects_to_delete: A 2-d list of objects to delete per thread.
per_thread_objects_deleted: A 2-d list to record the objects that have been
successfully deleted per thread.
| DeleteObjectsConcurrently | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def ListAndWaitForObjects(
service, counting_start_time, expected_set_of_objects, object_prefix
):
"""List objects and wait for consistency.
Args:
service: the ObjectStorageServiceBase object to use.
counting_start_time: The start time used to count for the inconsistency
window.
expected_set_... | List objects and wait for consistency.
Args:
service: the ObjectStorageServiceBase object to use.
counting_start_time: The start time used to count for the inconsistency
window.
expected_set_of_objects: The set of expectation.
object_prefix: The prefix of objects to list from.
Returns:
r... | ListAndWaitForObjects | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def AnalyzeListResults(
final_result,
result_consistent,
list_count,
list_latency,
total_wait_time,
list_scenario,
):
"""Analyze the results of list consistency test, and fill in the final result.
Args:
final_result: The final result array to fill in.
result_consistent: Is the final... | Analyze the results of list consistency test, and fill in the final result.
Args:
final_result: The final result array to fill in.
result_consistent: Is the final result consistent.
list_count: The number of lists done.
list_latency: The latency of the lists in seconds.
total_wait_time: Time spen... | AnalyzeListResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def SingleStreamThroughputBenchmark(service):
"""A benchmark test for single stream upload and download throughput.
Args:
service: the ObjectStorageServiceBase object to use.
Raises:
LowAvailabilityError: when the storage service has failed a high number of
our RW requests that exceeds a thresho... | A benchmark test for single stream upload and download throughput.
Args:
service: the ObjectStorageServiceBase object to use.
Raises:
LowAvailabilityError: when the storage service has failed a high number of
our RW requests that exceeds a threshold (>5%), we raise this error
instead of co... | SingleStreamThroughputBenchmark | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def RunWorkerProcesses(worker, worker_args, per_process_args=None):
"""Run a worker function in many processes, then gather and return the results
Args:
worker: either WriteWorker or ReadWorker. The worker function to call.
worker_args: a tuple. The arguments to pass to the worker function. The
resul... | Run a worker function in many processes, then gather and return the results
Args:
worker: either WriteWorker or ReadWorker. The worker function to call.
worker_args: a tuple. The arguments to pass to the worker function. The
result queue and stream number will be appended as the last two arguments.
... | RunWorkerProcesses | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def MultiStreamWrites(service):
"""Run multi-stream write benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
This function writes objects to the storage service, potentially
using multiple threads.
It doesn't return anything, but it outputs two sets of results in
two different ways... | Run multi-stream write benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
This function writes objects to the storage service, potentially
using multiple threads.
It doesn't return anything, but it outputs two sets of results in
two different ways. First, it writes a list of the name... | MultiStreamWrites | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def MultiStreamReads(service):
"""Run multi-stream read benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
This function reads a list of object names and sizes from
FLAGS.objects_written_file (in the format written by
MultiStreamWrites and then reads the objects from the storage
ser... | Run multi-stream read benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
This function reads a list of object names and sizes from
FLAGS.objects_written_file (in the format written by
MultiStreamWrites and then reads the objects from the storage
service, potentially using multiple thr... | MultiStreamReads | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def MultiStreamDelete(service):
"""Run multi-stream delete benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
This function deletes a list of object names and sizes from
FLAGS.objects_written_file (in the format written by
MultiStreamWrites and then deletes the objects from the storag... | Run multi-stream delete benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
This function deletes a list of object names and sizes from
FLAGS.objects_written_file (in the format written by
MultiStreamWrites and then deletes the objects from the storage
service, potentially using multip... | MultiStreamDelete | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def SleepUntilTime(when):
"""Sleep until a given time.
Args:
when: float. The time to sleep to, as a POSIX timestamp.
"""
now = time.time()
sleep_time = when - now
if sleep_time > 0.0:
time.sleep(sleep_time)
elif sleep_time == 0.0:
pass
else:
logging.info('Sleep time %s was too small',... | Sleep until a given time.
Args:
when: float. The time to sleep to, as a POSIX timestamp.
| SleepUntilTime | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def WriteWorker(
service,
payload,
size_distribution,
num_objects,
start_time,
naming_scheme,
result_queue,
worker_num,
):
"""Upload objects for the multi-stream writes benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
payload: a byte array. The bytes to ... | Upload objects for the multi-stream writes benchmark.
Args:
service: the ObjectStorageServiceBase object to use.
payload: a byte array. The bytes to upload.
size_distribution: the distribution of object sizes to use.
num_objects: the number of objects to upload.
start_time: a POSIX timestamp. Whe... | WriteWorker | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def DeleteWorker(service, object_records, result_queue, worker_num):
"""Delete objects for the multi-stream delete benchmark.
Performs bulk delete operation if specified by flag. Otherwise, deletes one
object per request.
Args:
service: the ObjectStorageServiceBase object to use.
object_records: the b... | Delete objects for the multi-stream delete benchmark.
Performs bulk delete operation if specified by flag. Otherwise, deletes one
object per request.
Args:
service: the ObjectStorageServiceBase object to use.
object_records: the bytes to delete.
result_queue: a mp.Queue to record results in.
wor... | DeleteWorker | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def OneByteRWBenchmark(service):
"""A benchmark test for one byte object read and write.
It uploads and downloads ONE_BYTE_OBJECT_COUNT number of 1-byte objects to the
storage service, keeps track of the latency of these operations, and print out
the result in JSON format at the end of the test.
Args:
s... | A benchmark test for one byte object read and write.
It uploads and downloads ONE_BYTE_OBJECT_COUNT number of 1-byte objects to the
storage service, keeps track of the latency of these operations, and print out
the result in JSON format at the end of the test.
Args:
service: the ObjectStorageServiceBase o... | OneByteRWBenchmark | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def ListConsistencyBenchmark(service):
"""A benchmark test to measure list-after-write consistency.
It uploads a large number of 1-byte objects in a short amount of time, and
then issues a list request. If the first list request returns all objects as
expected, then the result is deemed consistent. Otherwise, ... | A benchmark test to measure list-after-write consistency.
It uploads a large number of 1-byte objects in a short amount of time, and
then issues a list request. If the first list request returns all objects as
expected, then the result is deemed consistent. Otherwise, it keeps issuing
list request until all ex... | ListConsistencyBenchmark | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_api_tests.py | Apache-2.0 |
def DeleteObjects(
self,
bucket,
objects_to_delete,
objects_deleted=None,
delay_time=0,
object_sizes=None,
):
"""Delete a list of objects.
Args:
bucket: the name of the bucket.
objects_to_delete: a list of names of objects to delete.
objects_deleted: if g... | Delete a list of objects.
Args:
bucket: the name of the bucket.
objects_to_delete: a list of names of objects to delete.
objects_deleted: if given, a list to record the objects that have been
successfully deleted.
delay_time: time to delay each API call by
object_sizes: if giv... | DeleteObjects | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_interface.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/object_storage_api_test_scripts/object_storage_interface.py | Apache-2.0 |
def get_table_metadata(args):
"""Gets table metadata to create temporary views according to args passed."""
metadata = {}
if args.table_base_dir:
for table_name in args.table_names:
option_params = {'path': os.path.join(args.table_base_dir, table_name)}
if args.table_format == 'csv':
optio... | Gets table metadata to create temporary views according to args passed. | get_table_metadata | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/spark_sql_test_scripts/spark_sql_runner.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/spark_sql_test_scripts/spark_sql_runner.py | Apache-2.0 |
def run_sql_query(
spark_session, query_stream, stream_id, raise_query_execution_errors
):
"""Runs a SQL query stream, returns list[dict] with durations."""
results = []
for query_id in query_stream:
query = QUERIES[query_id]
try:
logging.info('Running query %s', query_id)
start = time.t... | Runs a SQL query stream, returns list[dict] with durations. | run_sql_query | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/scripts/spark_sql_test_scripts/spark_sql_runner.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/scripts/spark_sql_test_scripts/spark_sql_runner.py | Apache-2.0 |
def CreateAndStartTriggerThread(self, vm) -> None:
"""Create and start threads that runs the trigger.
Threads are guarded by a semaphore thus we never keep track of the
wait on these threads.
Args:
vm: A virtual machine.
"""
def TriggerEvent():
time.sleep(self.delay)
logging... | Create and start threads that runs the trigger.
Threads are guarded by a semaphore thus we never keep track of the
wait on these threads.
Args:
vm: A virtual machine.
| CreateAndStartTriggerThread | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/base_time_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/base_time_trigger.py | Apache-2.0 |
def SetUpTrigger(self, unused_sender, benchmark_spec):
"""Sets up the trigger. This method install relevant scripts on the VM."""
logging.info('Setting up Trigger %s.', self.trigger_name)
if _TRIGGER_VM_GROUPS.value:
for vm_group in _TRIGGER_VM_GROUPS.value:
if vm_group in benchmark_spec.vm_gr... | Sets up the trigger. This method install relevant scripts on the VM. | SetUpTrigger | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/base_time_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/base_time_trigger.py | Apache-2.0 |
def AppendSamples(
self,
unused_sender,
benchmark_spec: bm_spec.BenchmarkSpec,
samples: List[sample.Sample],
):
"""Append samples related to Live Migration."""
def generate_lm_total_time_samples() -> List[sample.Sample]:
lm_event_dicts = []
if self.capture_live_migration_t... | Append samples related to Live Migration. | AppendSamples | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | Apache-2.0 |
def _AppendAggregatedMetrics(self, samples: List[sample.Sample]):
"""Finds the time series samples and add generate the aggregated metrics."""
additional_samples = []
for s in samples:
if s.metric in TIME_SERIES_SAMPLES_FOR_AGGREGATION:
additional_samples += self._AggregateThroughputSample(s)
... | Finds the time series samples and add generate the aggregated metrics. | _AppendAggregatedMetrics | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | Apache-2.0 |
def _AggregateThroughputSample(self, s: sample.Sample) -> List[sample.Sample]:
"""Aggregate a time series sample into Live migration metrics.
Split the samples and compute mean and median and calls relevant
methods to generate an aggregated sample based on the time series sample.
Args:
s: A time... | Aggregate a time series sample into Live migration metrics.
Split the samples and compute mean and median and calls relevant
methods to generate an aggregated sample based on the time series sample.
Args:
s: A time series sample create using CreateTimeSeriesSample in samples.py
Returns:
A... | _AggregateThroughputSample | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | Apache-2.0 |
def _ComputeLossPercentile(
self, mean: float, values_after_lm: List[float], metadata: Dict[str, Any]
) -> List[sample.Sample]:
"""Compute loss percentile metrics.
This method samples of seconds_dropped_below_x_percent from 0% to 90%
in 10 percent increment. This is computed by a nested for loop an... | Compute loss percentile metrics.
This method samples of seconds_dropped_below_x_percent from 0% to 90%
in 10 percent increment. This is computed by a nested for loop and
comparing if value dropped below a given percentile.
Args:
mean: Mean of the baseline
values_after_lm: List of samples a... | _ComputeLossPercentile | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | Apache-2.0 |
def _ComputeLossWork(
self,
median: float,
values_after_lm: List[float],
interval: float,
metadata: Dict[str, Any],
):
"""Compute the loss work metrics for Live Migration.
This method returns two metrics.
1. The totl loss seconds. This is defined as the loss time across the ... | Compute the loss work metrics for Live Migration.
This method returns two metrics.
1. The totl loss seconds. This is defined as the loss time across the LM.
It is the sum of (Median - value) / median * interval
2. Unresponsive metrics. This is the cube of the lost time to degrade
the impact of LM i... | _ComputeLossWork | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | Apache-2.0 |
def _ComputeDegradation(
self, baseline_mean: float, mean: float, metadata: Dict[str, Any]
) -> List[sample.Sample]:
"""Compute the degradation after LM ends to baseline."""
return [
sample.Sample(
'degradation_percent',
round((baseline_mean - mean) / baseline_mean * 100,... | Compute the degradation after LM ends to baseline. | _ComputeDegradation | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | Apache-2.0 |
def Register(parsed_flags):
"""Registers the simulate maintenance trigger if FLAGS.simulate_maintenance is set."""
if not parsed_flags.simulate_maintenance:
return
trigger = MaintenanceEventTrigger()
trigger.Register() | Registers the simulate maintenance trigger if FLAGS.simulate_maintenance is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/time_triggers/maintenance_simulation_trigger.py | Apache-2.0 |
def Analyze(self, unused_sender, benchmark_spec, samples):
"""Analyze asadm summary file and record samples."""
def _Analyze(role, f):
"""Parse file and record samples."""
with open(
os.path.join(self.output_directory, os.path.basename(f))) as fp:
output = fp.read()
metada... | Analyze asadm summary file and record samples. | Analyze | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/asadm.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/asadm.py | Apache-2.0 |
def Analyze(self, unused_sender, benchmark_spec, samples):
"""Analyze asadm latency file and record samples."""
def _Analyze(role, f):
"""Parse file and record samples."""
with open(
os.path.join(self.output_directory, os.path.basename(f))) as fp:
output = fp.read()
metada... | Analyze asadm latency file and record samples. | Analyze | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/asadm.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/asadm.py | Apache-2.0 |
def Register(parsed_flags):
"""Registers the ops agent collector if FLAGS.enable_asadm_log is set."""
if not parsed_flags.enable_asadm_log:
return
logging.info('Registering asadm collector.')
# Collecting disk/memory usage
summary_c = _AsadmSummaryCollector(interval=FLAGS.asadm_interval_secs)
events.b... | Registers the ops agent collector if FLAGS.enable_asadm_log is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/asadm.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/asadm.py | Apache-2.0 |
def _AnalyzeAsadmLatencyResults(metadata, output, samples):
"""Parse asadm result.
Args:
metadata: metadata of the sample.
output: the output of the stress-ng benchmark.
samples: list of samples to return.
"""
output_lines = output.splitlines()
timestamps_in_ms = []
read_iops = []
read_lat_1_... | Parse asadm result.
Args:
metadata: metadata of the sample.
output: the output of the stress-ng benchmark.
samples: list of samples to return.
| _AnalyzeAsadmLatencyResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/asadm.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/asadm.py | Apache-2.0 |
def ParseTimestamp(line: str) -> float:
"""Convert a timestamp string to an epoch time.
Args:
line: the line with a timestamp string.
Returns:
The epoch time in ms (float) for the given timestamp.
"""
if not str:
raise ValueError('Timestamp in wrong format: emptry string')
timestamp = re.finda... | Convert a timestamp string to an epoch time.
Args:
line: the line with a timestamp string.
Returns:
The epoch time in ms (float) for the given timestamp.
| ParseTimestamp | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/asadm.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/asadm.py | Apache-2.0 |
def ParseUsedValue(value: str) -> (float, str):
"""Parse the Aerospike output with unit.
Args:
value: The output from Aerospike, which contains a number and its unit.
Returns:
A tuple of a number and its unit.
"""
splits = value.split()
if len(splits) != 2:
raise ValueError('Used value in wron... | Parse the Aerospike output with unit.
Args:
value: The output from Aerospike, which contains a number and its unit.
Returns:
A tuple of a number and its unit.
| ParseUsedValue | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/asadm.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/asadm.py | Apache-2.0 |
def ConvertToGB(value: str, unit: str) -> float:
"""Convert value to GB so all records uses the same unit.
Args:
value: The data to be converted.
unit: The unit of the data.
Returns:
The value in GB.
"""
if unit.upper() not in GB_CONVERSION_FACTOR:
raise ValueError(f'Support GB|TB but get {u... | Convert value to GB so all records uses the same unit.
Args:
value: The data to be converted.
unit: The unit of the data.
Returns:
The value in GB.
| ConvertToGB | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/asadm.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/asadm.py | Apache-2.0 |
def __init__(self, interval=None, output_directory=None):
"""Runs collector on 'vms'.
Start collector collection via `Start`. Stop via `Stop`.
Args:
interval: Optional int. Interval in seconds in which to collect samples.
output_directory: Optional directory where to save collection output.
... | Runs collector on 'vms'.
Start collector collection via `Start`. Stop via `Stop`.
Args:
interval: Optional int. Interval in seconds in which to collect samples.
output_directory: Optional directory where to save collection output.
Raises:
IOError: for when the output directory doesn't e... | __init__ | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/base_collector.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/base_collector.py | Apache-2.0 |
def _KillCommand(self, vm, pid):
"""Command to kill off the collector."""
if vm.BASE_OS_TYPE == os_types.WINDOWS:
return 'taskkill /PID {} /F'.format(pid)
else:
return 'kill -INT {}'.format(pid) | Command to kill off the collector. | _KillCommand | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/base_collector.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/base_collector.py | Apache-2.0 |
def _StartOnVm(self, vm, suffix=''):
"""Start collector, having it write to an output file."""
self._InstallCollector(vm)
suffix = '{}-{}'.format(suffix, self._CollectorName())
if vm.BASE_OS_TYPE == os_types.WINDOWS:
collector_file = os.path.join(
vm.temp_dir, '{}{}.log'.format(vm.name, ... | Start collector, having it write to an output file. | _StartOnVm | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/base_collector.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/base_collector.py | Apache-2.0 |
def _StopOnVm(self, vm, vm_role):
"""Stop collector on 'vm' and copy the files back."""
if vm.name not in self._pid_files:
logging.warning('No collector PID for %s', vm.name)
return
else:
with self._lock:
pid, file_name = self._pid_files.pop(vm.name)
vm.RemoteCommand(self._Kill... | Stop collector on 'vm' and copy the files back. | _StopOnVm | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/base_collector.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/base_collector.py | Apache-2.0 |
def Start(self, sender, benchmark_spec):
"""Install and start collector on VMs specified in trace vm groups'."""
suffix = '-{}-{}'.format(benchmark_spec.uid, str(uuid.uuid4())[:8])
if _TRACE_VM_GROUPS.value:
for vm_group in _TRACE_VM_GROUPS.value:
if vm_group in benchmark_spec.vm_groups:
... | Install and start collector on VMs specified in trace vm groups'. | Start | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/base_collector.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/base_collector.py | Apache-2.0 |
def StartOnVms(self, sender, vms, id_suffix):
"""Install and start collector on given subset of vms.
Args:
sender: sender of the request/event to start collector.
vms: vms to run the collector on.
id_suffix: id_suffix of the collector output file.
"""
del sender # unused
func = f... | Install and start collector on given subset of vms.
Args:
sender: sender of the request/event to start collector.
vms: vms to run the collector on.
id_suffix: id_suffix of the collector output file.
| StartOnVms | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/base_collector.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/base_collector.py | Apache-2.0 |
def StopOnVms(self, sender, name):
"""Stop collector on given subset of vms, fetch results.
Args:
sender: sender of the event to stop the collector.
name: name of event to be stopped.
"""
events.record_event.send(
sender,
event=name,
start_timestamp=self._start_time,... | Stop collector on given subset of vms, fetch results.
Args:
sender: sender of the event to stop the collector.
name: name of event to be stopped.
| StopOnVms | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/base_collector.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/base_collector.py | Apache-2.0 |
def _FetchResults(self, vm):
"""Stops collectd on the VM, fetches CSV results."""
logging.info('Fetching collectd results')
local_dir = os.path.join(self.target_dir, vm.name + '-collectd')
# On the remote host, CSV files are in:
# self.csv_dir/<fqdn>/<category>.
# Since AWS VMs have a FQDN diffe... | Stops collectd on the VM, fetches CSV results. | _FetchResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/collectd.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/collectd.py | Apache-2.0 |
def Before(self, unused_sender, benchmark_spec):
"""Install collectd.
Args:
benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark currently
running.
"""
logging.info('Installing collectd')
vms = benchmark_spec.vms
background_tasks.RunThreaded(lambda vm: vm.Install('collectd'... | Install collectd.
Args:
benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark currently
running.
| Before | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/collectd.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/collectd.py | Apache-2.0 |
def After(self, unused_sender, benchmark_spec):
"""Stop / delete collectd, fetch results from VMs.
Args:
benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark that stopped
running.
"""
logging.info('Stopping collectd')
vms = benchmark_spec.vms
background_tasks.RunThreaded(se... | Stop / delete collectd, fetch results from VMs.
Args:
benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark that stopped
running.
| After | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/collectd.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/collectd.py | Apache-2.0 |
def Register(parsed_flags):
"""Register the collector if FLAGS.collectd is set."""
if not parsed_flags.collectd:
return
logging.info('Registering collectd collector')
output_directory = parsed_flags.collectd_output or vm_util.GetTempDir()
if not os.path.isdir(output_directory):
raise OSError(
... | Register the collector if FLAGS.collectd is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/collectd.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/collectd.py | Apache-2.0 |
def Analyze(self, unused_sender, benchmark_spec, samples):
"""Analyze dstat file and record samples."""
def _AnalyzeEvent(role, labels, out, event):
# Find out index of rows belong to event according to timestamp.
cond = (out[:, 0] > event.start_timestamp) & (
out[:, 0] < event.end_timest... | Analyze dstat file and record samples. | Analyze | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/dstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/dstat.py | Apache-2.0 |
def Register(parsed_flags):
"""Registers the dstat collector if FLAGS.dstat is set."""
if not parsed_flags.dstat:
return
output_directory = (
parsed_flags.dstat_output
if parsed_flags['dstat_output'].present
else vm_util.GetTempDir()
)
logging.debug(
'Registering dstat collector ... | Registers the dstat collector if FLAGS.dstat is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/dstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/dstat.py | Apache-2.0 |
def _IostatResults(
metadata: dict[str, str],
json_output: Any,
samples: List[sample.Sample],
disk_metrics: list[str],
cpu_metrics: list[str],
interval: int,
device_regex: str | None,
) -> None:
"""Parses iostat json data and adds samples."""
stats = json_output['sysstat']['hosts']
cou... | Parses iostat json data and adds samples. | _IostatResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/iostat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/iostat.py | Apache-2.0 |
def Register(parsed_flags: flags.FlagValues) -> None:
"""Registers the iostat collector if FLAGS.iostat is set."""
if not parsed_flags.iostat:
return
collector = IostatCollector(
interval=parsed_flags.iostat_interval,
disk_metrics=parsed_flags.iostat_metrics,
cpu_metrics=parsed_flags.iostat... | Registers the iostat collector if FLAGS.iostat is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/iostat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/iostat.py | Apache-2.0 |
def Register(parsed_flags):
"""Registers the sar collector if FLAGS.sar is set."""
if not parsed_flags.mongo_diagnostics:
return
output_directory = vm_util.GetTempDir()
logging.debug(
'Registering mongo_diagnostics collector output to %s.',
output_directory,
)
if not os.path.isdir(output_... | Registers the sar collector if FLAGS.sar is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mongo_diagnostics.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mongo_diagnostics.py | Apache-2.0 |
def _ParseStartTime(output: str) -> float:
"""Parse the start time of the mpstat report.
Args:
output: output of mpstat
Returns:
An integer representing the unix time at which the first sample in the
report was run.
Example input:
third_party/py/perfkitbenchmarker/tests/data/mpstat_output.j... | Parse the start time of the mpstat report.
Args:
output: output of mpstat
Returns:
An integer representing the unix time at which the first sample in the
report was run.
Example input:
third_party/py/perfkitbenchmarker/tests/data/mpstat_output.json
| _ParseStartTime | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def _GetCPUMetrics(host_stats):
"""Generate list of metrics that we want to publish.
Args:
host_stats: List of mpstat reports.
Returns:
List of metrics that we want to publish.
"""
cpu_metrics = []
for cpu_metric in host_stats[0]['cpu-load'][0]:
# we don't want to generate a sample for cpu - c... | Generate list of metrics that we want to publish.
Args:
host_stats: List of mpstat reports.
Returns:
List of metrics that we want to publish.
| _GetCPUMetrics | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def _GetCPUAverageMetrics(
host_stats: List[Dict[str, Any]],
number_of_cpus: int,
metadata: Dict[str, Any],
timestamp: float | None = None,
):
"""Get average metrics for all CPUs.
Args:
host_stats: List of mpstat reports.
number_of_cpus: how many CPUs are being used.
metadata: metadata ... | Get average metrics for all CPUs.
Args:
host_stats: List of mpstat reports.
number_of_cpus: how many CPUs are being used.
metadata: metadata of the sample.
timestamp: timestamp of the sample.
Returns:
List of samples - containing the average metrics for all CPUs.
input data:
[
{
... | _GetCPUAverageMetrics | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def _GetCPUAverageInterruptions(
host_stats: List[Dict[str, Any]],
number_of_cpus: int,
metadata: Dict[str, Any],
timestamp: float | None = None,
):
"""Get average interruption for all CPUs.
Args:
host_stats: List of mpstat reports.
number_of_cpus: how many CPUs are being used.
metadata... | Get average interruption for all CPUs.
Args:
host_stats: List of mpstat reports.
number_of_cpus: how many CPUs are being used.
metadata: metadata of the sample.
timestamp: timestamp of the sample.
Returns:
List of samples - containing the average metrics for all CPUs.
input data:
[
{
... | _GetCPUAverageInterruptions | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def _GetPerIntervalSamples(
host_stats: List[Dict[str, Any]],
metadata: Dict[str, Any],
start_timestamp: int,
interval: int,
) -> List[sample.Sample]:
"""Generate samples for all CPU related metrics in every run of mpstat.
Args:
host_stats: List of mpstat reports.
metadata: metadata of the ... | Generate samples for all CPU related metrics in every run of mpstat.
Args:
host_stats: List of mpstat reports.
metadata: metadata of the sample.
start_timestamp: a unix timestamp representing the start of the first
reporting period.
interval: the interval between mpstat reports
Returns:
... | _GetPerIntervalSamples | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def _MpstatResults(
metadata: Dict[str, Any],
output: Dict[str, Any],
interval: int,
per_interval_samples: bool = False,
):
"""Parses and appends mpstat results to the samples list.
Args:
metadata: metadata of the sample.
output: output of mpstat in JSON format
interval: the interval be... | Parses and appends mpstat results to the samples list.
Args:
metadata: metadata of the sample.
output: output of mpstat in JSON format
interval: the interval between mpstat reports; required if
per_interval_samples is True
per_interval_samples: whether a sample per interval should be published
... | _MpstatResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def Analyze(self, unused_sender, benchmark_spec, samples):
"""Analyze mpstat file and record samples.
Args:
benchmark_spec: benchmark_spec of this run.
samples: samples to add stats to.
"""
def _Analyze(role, output):
"""Parse file and record samples."""
with open(
os... | Analyze mpstat file and record samples.
Args:
benchmark_spec: benchmark_spec of this run.
samples: samples to add stats to.
| Analyze | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def Register(parsed_flags):
"""Registers the mpstat collector if FLAGS.mpstat is set."""
if not parsed_flags.mpstat:
return
logging.debug('Registering mpstat collector.')
collector = MpstatCollector(
interval=parsed_flags.mpstat_interval,
per_interval_samples=parsed_flags.mpstat_publish_per_in... | Registers the mpstat collector if FLAGS.mpstat is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/mpstat.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/mpstat.py | Apache-2.0 |
def _NvidiaPowerResults(
metadata: Dict[str, Any],
output: csv.DictReader,
samples: List[sample.Sample],
query_items: List[str],
) -> None:
"""Parse output lines to get samples.
Args:
metadata: metadata.
output: csv dict reader pointing to the collector_file.
samples: list of samples to... | Parse output lines to get samples.
Args:
metadata: metadata.
output: csv dict reader pointing to the collector_file.
samples: list of samples to append parsed results to.
query_items: list of query items.
| _NvidiaPowerResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/nvidia_power.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/nvidia_power.py | Apache-2.0 |
def Analyze(
self,
unused_sender,
benchmark_spec: BenchmarkSpec,
samples: List[sample.Sample],
) -> None:
"""Analyze Nvidia power and record samples."""
def _Analyze(role: str, collector_file: str) -> None:
with open(
os.path.join(self.output_directory, os.path.basenam... | Analyze Nvidia power and record samples. | Analyze | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/nvidia_power.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/nvidia_power.py | Apache-2.0 |
def Register(parsed_flags: flags) -> None:
"""Registers the Nvidia power collector if FLAGS.nvidia_power is set."""
if not parsed_flags.nvidia_power:
return
collector = _NvidiaPowerCollector(
selections=_SELECTIONS.value,
interval=_INTERVAL.value,
output_directory=vm_util.GetTempDir(),
)
... | Registers the Nvidia power collector if FLAGS.nvidia_power is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/nvidia_power.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/nvidia_power.py | Apache-2.0 |
def Register(parsed_flags):
"""Registers the ops agent collector if FLAGS.ops_agent is set."""
if not parsed_flags.ops_agent:
return
logging.debug('Registering ops_agent collector.')
collector = _OpsAgentCollector()
events.before_phase.connect(collector.Start, stages.RUN, weak=False)
events.after_phas... | Registers the ops agent collector if FLAGS.ops_agent is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/ops_agent.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/ops_agent.py | Apache-2.0 |
def Analyze(self, unused_sender, benchmark_spec, samples):
"""Parse otel metric file and record samples.
Args:
benchmark_spec: benchmark_spec of this run.
samples: samples to add stats to.
"""
logging.debug('Parsing otel collector data.')
def _Analyze(role, file):
parsed_metrics... | Parse otel metric file and record samples.
Args:
benchmark_spec: benchmark_spec of this run.
samples: samples to add stats to.
| Analyze | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/otel.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/otel.py | Apache-2.0 |
def Register(parsed_flags):
"""Registers the otel collector if FLAGS.otel is set."""
if not parsed_flags.otel:
return
logging.debug('Registering otel collector.')
output_directory = (
parsed_flags.otel_output_directory
if parsed_flags['otel_output_directory'].value
else vm_util.GetTempDi... | Registers the otel collector if FLAGS.otel is set. | Register | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/traces/otel.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/otel.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.