Skip to content

Commit

Permalink
PR comments REV2
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-munro committed Aug 17, 2023
1 parent 0627c2d commit 76d9c36
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 42 deletions.
6 changes: 6 additions & 0 deletions google-cloud-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@
<version>1.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.0</version>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
* 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.
* 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;
package com.google.cloud.storage.benchmarking;

import com.google.common.base.MoreObjects;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
* 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.
* 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;
package com.google.cloud.storage.benchmarking;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
Expand Down Expand Up @@ -66,7 +65,8 @@ public final class StorageSharedBenchmarkingCli implements Runnable {
@Option(
names = "-object_size",
defaultValue = "1048576..1048576",
description = "any positive integer, or an inclusive range such as min..max where min and max are positive integers")
description =
"any positive integer, or an inclusive range such as min..max where min and max are positive integers")
String objectSize;

@Option(
Expand All @@ -88,8 +88,13 @@ public static void main(String[] args) {

@Override
public void run() {
// TODO: Make this a switch once we add more workloads
runWorkload1();
switch (testType) {
case "w1r3":
runWorkload1();
break;
default:
throw new IllegalStateException("Specify a workload to run");
}
}

private void runWorkload1() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
* 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.
* 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;
package com.google.cloud.storage.benchmarking;

import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
Expand All @@ -26,7 +24,8 @@ class StorageSharedBenchmarkingUtils {
public static int DEFAULT_NUMBER_OF_READS = 3;

public static void cleanupObject(Storage storage, Blob created) {
storage.delete(created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
storage.delete(
created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
}

public static double calculateThroughput(long size, Duration elapsedTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
* 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.
* 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;
package com.google.cloud.storage.benchmarking;

import com.google.cloud.storage.Blob;
import com.google.cloud.storage.BlobInfo;
Expand Down Expand Up @@ -55,7 +54,8 @@ public String call() throws Exception {
System.out.println(
generateCloudMonitoringResult(
"WRITE",
StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeUpload),
StorageSharedBenchmarkingUtils.calculateThroughput(
created.getSize().longValue(), elapsedTimeUpload),
created)
.toString());
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
Expand All @@ -68,7 +68,8 @@ public String call() throws Exception {
System.out.println(
generateCloudMonitoringResult(
"READ[" + i + "]",
StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeDownload),
StorageSharedBenchmarkingUtils.calculateThroughput(
created.getSize().longValue(), elapsedTimeDownload),
created)
.toString());
}
Expand Down
7 changes: 4 additions & 3 deletions ssb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
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>
<artifactId>storage-shared-benchmarking</artifactId>
<version>0.0.1-SNAPSHOT</version><!-- This artifact should not be released -->

<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.2.0</version>
<relativePath/>
</parent>

<artifactId>ssb</artifactId>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -76,7 +77,7 @@
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>dependency-jars/</classpathPrefix>
<mainClass>com.google.cloud.StorageSharedBenchmarkingCli</mainClass>
<mainClass>com.google.cloud.storage.benchmarking.StorageSharedBenchmarkingCli</mainClass>
</manifest>
</archive>
</configuration>
Expand Down

0 comments on commit 76d9c36

Please sign in to comment.