Skip to content

Commit

Permalink
feat: Initial CLI for SSB integration and Workload 1 (#2166)
Browse files Browse the repository at this point in the history
* feat: Initial CLI for SSB integration 
* Switch to using maven-shade-plugin

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
sydney-munro and gcf-owl-bot[bot] authored Aug 23, 2023
1 parent 4aa44c3 commit a349735
Show file tree
Hide file tree
Showing 6 changed files with 681 additions and 0 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
<module>proto-google-cloud-storage-v2</module>
<module>gapic-google-cloud-storage-v2</module>
<module>google-cloud-storage-bom</module>
<module>storage-shared-benchmarking</module>
</modules>

<profiles>
Expand Down
114 changes: 114 additions & 0 deletions storage-shared-benchmarking/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<packaging>jar</packaging>
<artifactId>storage-shared-benchmarking</artifactId>
<version>0.0.1-SNAPSHOT</version><!-- This artifact should not be released -->
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage-parent</artifactId>
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
</parent>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
</dependency>
</dependencies>

<build>
<!-- This plugin enables building the application to a JAR *not* using Native Image -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${uberjar.name}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.google.cloud.storage.benchmarking.StorageSharedBenchmarkingCli</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<!--
Shading signed JARs will fail without this.
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.storage.benchmarking;

import com.google.common.base.MoreObjects;
import java.util.Objects;

final class CloudMonitoringResult {
private final String library;
private final String api;
private final String op;

private final int workers;
private final int object_size;
private final int app_buffer_size;
private final int chunksize;
private final boolean crc32c_enabled;
private final boolean md5_enabled;
private final int cpu_time_us;
private final String bucket_name;
private final String status;
private final String transfer_size;
private final String transfer_offset;
private final String failure_msg;
private final double throughput;

CloudMonitoringResult(
String library,
String api,
String op,
int workers,
int objectSize,
int appBufferSize,
int chunksize,
boolean crc32cEnabled,
boolean md5Enabled,
int cpuTimeUs,
String bucketName,
String status,
String transferSize,
String transferOffset,
String failureMsg,
double throughput) {
this.library = library;
this.api = api;
this.op = op;
this.workers = workers;
this.object_size = objectSize;
this.app_buffer_size = appBufferSize;
this.chunksize = chunksize;
this.crc32c_enabled = crc32cEnabled;
this.md5_enabled = md5Enabled;
this.cpu_time_us = cpuTimeUs;
this.bucket_name = bucketName;
this.status = status;
this.transfer_size = transferSize;
this.transfer_offset = transferOffset;
this.failure_msg = failureMsg;
this.throughput = throughput;
}

public static Builder newBuilder() {
return new Builder();
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("library", library)
.add("api", api)
.add("op", op)
.add("workers", workers)
.add("object_size", object_size)
.add("app_buffer_size", app_buffer_size)
.add("chunksize", chunksize)
.add("crc32c_enabled", crc32c_enabled)
.add("md5_enabled", md5_enabled)
.add("cpu_time_us", cpu_time_us)
.add("bucket_name", bucket_name)
.add("status", status)
.add("transfer_size", transfer_size)
.add("transfer_offset", transfer_offset)
.add("failure_msg", failure_msg)
.add("throughput", throughput)
.toString();
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CloudMonitoringResult)) {
return false;
}
CloudMonitoringResult result = (CloudMonitoringResult) o;
return workers == result.workers
&& object_size == result.object_size
&& app_buffer_size == result.app_buffer_size
&& chunksize == result.chunksize
&& crc32c_enabled == result.crc32c_enabled
&& md5_enabled == result.md5_enabled
&& cpu_time_us == result.cpu_time_us
&& Double.compare(result.throughput, throughput) == 0
&& Objects.equals(library, result.library)
&& Objects.equals(api, result.api)
&& Objects.equals(op, result.op)
&& Objects.equals(bucket_name, result.bucket_name)
&& Objects.equals(status, result.status)
&& Objects.equals(transfer_size, result.transfer_size)
&& Objects.equals(transfer_offset, result.transfer_offset)
&& Objects.equals(failure_msg, result.failure_msg);
}

@Override
public int hashCode() {
return Objects.hash(
library,
api,
op,
workers,
object_size,
app_buffer_size,
chunksize,
crc32c_enabled,
md5_enabled,
cpu_time_us,
bucket_name,
status,
transfer_size,
transfer_offset,
failure_msg,
throughput);
}

public static class Builder {

private String library;
private String api;
private String op;
private int workers;
private int objectSize;
private int appBufferSize;
private int chunksize;
private boolean crc32cEnabled;
private boolean md5Enabled;
private int cpuTimeUs;
private String bucketName;
private String status;
private String transferSize;
private String transferOffset;
private String failureMsg;
private double throughput;

public Builder setLibrary(String library) {
this.library = library;
return this;
}

public Builder setApi(String api) {
this.api = api;
return this;
}

public Builder setOp(String op) {
this.op = op;
return this;
}

public Builder setWorkers(int workers) {
this.workers = workers;
return this;
}

public Builder setObjectSize(int objectSize) {
this.objectSize = objectSize;
return this;
}

public Builder setAppBufferSize(int appBufferSize) {
this.appBufferSize = appBufferSize;
return this;
}

public Builder setChunksize(int chunksize) {
this.chunksize = chunksize;
return this;
}

public Builder setCrc32cEnabled(boolean crc32cEnabled) {
this.crc32cEnabled = crc32cEnabled;
return this;
}

public Builder setMd5Enabled(boolean md5Enabled) {
this.md5Enabled = md5Enabled;
return this;
}

public Builder setCpuTimeUs(int cpuTimeUs) {
this.cpuTimeUs = cpuTimeUs;
return this;
}

public Builder setBucketName(String bucketName) {
this.bucketName = bucketName;
return this;
}

public Builder setStatus(String status) {
this.status = status;
return this;
}

public Builder setTransferSize(String transferSize) {
this.transferSize = transferSize;
return this;
}

public Builder setTransferOffset(String transferOffset) {
this.transferOffset = transferOffset;
return this;
}

public Builder setFailureMsg(String failureMsg) {
this.failureMsg = failureMsg;
return this;
}

public Builder setThroughput(double throughput) {
this.throughput = throughput;
return this;
}

public CloudMonitoringResult build() {
return new CloudMonitoringResult(
library,
api,
op,
workers,
objectSize,
appBufferSize,
chunksize,
crc32cEnabled,
md5Enabled,
cpuTimeUs,
bucketName,
status,
transferSize,
transferOffset,
failureMsg,
throughput);
}
}
}
Loading

0 comments on commit a349735

Please sign in to comment.