pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mme...@apache.org
Subject [pulsar] branch master updated: Specify default for cpu/ram/disk (#2820)
Date Tue, 23 Oct 2018 05:57:31 GMT
This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new c7c7696  Specify default for cpu/ram/disk (#2820)
c7c7696 is described below

commit c7c769654e583082f78482179380ec8cc4246088
Author: Sanjeev Kulkarni <sanjeevrk@gmail.com>
AuthorDate: Mon Oct 22 22:57:26 2018 -0700

    Specify default for cpu/ram/disk (#2820)
    
    * Specify default for cpu/ram/disk
    
    * Removed tests that no longer make sense
---
 .../org/apache/pulsar/admin/cli/TestCmdSinks.java  | 66 ----------------------
 .../apache/pulsar/admin/cli/TestCmdSources.java    | 57 -------------------
 .../apache/pulsar/functions/utils/Resources.java   |  9 ++-
 3 files changed, 6 insertions(+), 126 deletions(-)

diff --git a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
index a050997..67518d5 100644
--- a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
+++ b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
@@ -478,72 +478,6 @@ public class TestCmdSinks {
     }
 
     @Test
-    public void testMissingCpu() throws Exception {
-        SinkConfig sinkConfig = getSinkConfig();
-        sinkConfig.setResources(new Resources(null, RAM, DISK));
-        testCmdSinkCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                INPUTS,
-                TOPIC_PATTERN,
-                CUSTOM_SERDE_INPUT_STRING,
-                PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                null,
-                RAM,
-                DISK,
-                SINK_CONFIG_STRING,
-                sinkConfig
-        );
-    }
-
-    @Test
-    public void testMissingRam() throws Exception {
-        SinkConfig sinkConfig = getSinkConfig();
-        sinkConfig.setResources(new Resources(CPU, null, DISK));
-        testCmdSinkCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                INPUTS,
-                TOPIC_PATTERN,
-                CUSTOM_SERDE_INPUT_STRING,
-                PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                null,
-                DISK,
-                SINK_CONFIG_STRING,
-                sinkConfig
-        );
-    }
-
-    @Test
-    public void testMissingDisk() throws Exception {
-        SinkConfig sinkConfig = getSinkConfig();
-        sinkConfig.setResources(new Resources(CPU, RAM, null));
-        testCmdSinkCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                INPUTS,
-                TOPIC_PATTERN,
-                CUSTOM_SERDE_INPUT_STRING,
-                PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                RAM,
-                null,
-                SINK_CONFIG_STRING,
-                sinkConfig
-        );
-    }
-
-    @Test
     public void testMissingConfig() throws Exception {
         SinkConfig sinkConfig = getSinkConfig();
         sinkConfig.setConfigs(null);
diff --git a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
index 318dbe6..63574f9 100644
--- a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
+++ b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
@@ -372,63 +372,6 @@ public class TestCmdSources {
     }
 
     @Test
-    public void testMissingCpu() throws Exception {
-        SourceConfig sourceConfig = getSourceConfig();
-        sourceConfig.setResources(new Resources(null, RAM, DISK));
-        testCmdSourceCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                null,
-                RAM,
-                DISK,
-                SINK_CONFIG_STRING,
-                sourceConfig
-        );
-    }
-
-    @Test
-    public void testMissingRam() throws Exception {
-        SourceConfig sourceConfig = getSourceConfig();
-        sourceConfig.setResources(new Resources(CPU, null, DISK));
-        testCmdSourceCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                null,
-                DISK,
-                SINK_CONFIG_STRING,
-                sourceConfig
-        );
-    }
-
-    @Test
-    public void testMissingDisk() throws Exception {
-        SourceConfig sourceConfig = getSourceConfig();
-        sourceConfig.setResources(new Resources(CPU, RAM, null));
-        testCmdSourceCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                RAM,
-                null,
-                SINK_CONFIG_STRING,
-                sourceConfig
-        );
-    }
-
-    @Test
     public void testMissingConfig() throws Exception {
         SourceConfig sourceConfig = getSourceConfig();
         sourceConfig.setConfigs(null);
diff --git a/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
b/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
index 5c707fa..fc187f7 100644
--- a/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
+++ b/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
@@ -28,7 +28,10 @@ import lombok.*;
 @AllArgsConstructor
 @NoArgsConstructor
 public class Resources {
-    private Double cpu;
-    private Long ram;
-    private Long disk;
+    // Default cpu is 1 core
+    private Double cpu = 1d;
+    // Default memory is 1GB
+    private Long ram = 1073741824l;
+    // Default disk is 10GB
+    private Long disk = 10737418240l;
 }


Mime
View raw message