support file and directory mount perf_test
authorcoderzc <zc1217zc@126.com>
Fri, 7 Jan 2022 14:34:03 +0000 (22:34 +0800)
committercoderzc <zc1217zc@126.com>
Fri, 7 Jan 2022 15:06:51 +0000 (23:06 +0800)
computer-core/src/main/java/com/baidu/hugegraph/computer/core/config/ComputerOptions.java
computer-k8s-operator/src/main/java/com/baidu/hugegraph/computer/k8s/operator/controller/ComputerJobDeployer.java
computer-test/src/main/java/com/baidu/hugegraph/computer/k8s/MiniKubeTest.java

index d8ac12ec508579100567f77d0530d35bdb28efc9..750859521bbe9ebcbc743ca7373a13bfe525afb2 100644 (file)
@@ -345,7 +345,7 @@ public class ComputerOptions extends OptionHolder {
                     "output.hdfs_delimiter",
                     "The delimiter of hdfs output.",
                     disallowEmpty(),
-                    String.valueOf((char) 27)
+                    ","
             );
 
     public static final ConfigOption<Boolean> OUTPUT_HDFS_MERGE =
index 2ac40ff295d1783707ecca8191140b10f32f614e..bf1832f0a6e7b091ddefb2079d403afa91b77676 100644 (file)
@@ -490,11 +490,15 @@ public class ComputerJobDeployer {
         }
         Set<Map.Entry<String, String>> entries = paths.entrySet();
         for (Map.Entry<String, String> entry : entries) {
-            VolumeMount volumeMount = new VolumeMountBuilder()
-                    .withName(this.volumeName(entry.getKey()))
-                    .withMountPath(entry.getValue())
-                    .withReadOnly(true)
-                    .build();
+            String path = entry.getValue();
+            VolumeMountBuilder volumeMountBuilder = new VolumeMountBuilder()
+                               .withName(this.volumeName(entry.getKey()))
+                               .withMountPath(path);
+            if (!path.endsWith("/")) {
+                String subPath = path.substring(path.lastIndexOf("/") + 1);
+                volumeMountBuilder.withSubPath(subPath);
+            }
+            VolumeMount volumeMount = volumeMountBuilder.build();
             volumeMounts.add(volumeMount);
         }
 
index a106ac7da81570617fe2b8fa7e4939a2b08eed28..328722c40a58a363e776ea08594e601fa6fb9b3e 100644 (file)
@@ -393,10 +393,10 @@ public class MiniKubeTest extends AbstractK8sTest {
 
         Map<String, String> params = new HashMap<>();
         params.put(KubeSpecOptions.CONFIG_MAP_PATHS.name(),
-                   String.format("[%s:/opt/configmap123]",
+                   String.format("[%s:/opt/configmap123/1.txt]",
                                  configMapName));
         params.put(KubeSpecOptions.SECRET_PATHS.name(),
-                   String.format("[%s:/opt/secret123]", secretName));
+                   String.format("[%s:/opt/secret123/]", secretName));
 
         String jobId = this.driver.submitJob(ALGORITHM_NAME, params);