You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/09/25 03:29:20 UTC

[GitHub] [incubator-pinot] bradengroom opened a new pull request #6059: Add CLI commands for interacting with PinotFS

bradengroom opened a new pull request #6059:
URL: https://github.com/apache/incubator-pinot/pull/6059


   ## Description
   Add a description of your PR here.
   A good description should include pointers to an issue or design document, etc.
   ## Upgrade Notes
   Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)
   * [ ] Yes (Please label as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR fix a zero-downtime upgrade introduced earlier?
   * [ ] Yes (Please label this as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR otherwise need attention when creating release notes? Things to consider:
   - New configuration options
   - Deprecation of configurations
   - Signature changes to public methods/interfaces
   - New plugins added or old plugins removed
   * [ ] Yes (Please label this PR as **<code>release-notes</code>** and complete the section on Release Notes)
   ## Release Notes
   If you have tagged this as either backward-incompat or release-notes,
   you MUST add text here that you would like to see appear in release notes of the
   next release.
   
   If you have a series of commits adding or enabling a feature, then
   add this section only in final commit that marks the feature completed.
   Refer to earlier release notes to see examples of text
   
   ## Documentation
   If you have introduced a new feature or configuration, please add it to the documentation as well.
   See https://docs.pinot.apache.org/developers/developers-and-contributors/update-document
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #6059: [WIP] Add CLI commands for interacting with PinotFS

Posted by GitBox <gi...@apache.org>.
mayankshriv commented on a change in pull request #6059:
URL: https://github.com/apache/incubator-pinot/pull/6059#discussion_r497090804



##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/filesystem/LocalPinotFS.java
##########
@@ -111,7 +111,7 @@ public long length(URI fileUri) {
     if (!recursive) {
       return Arrays.stream(file.list()).map(s -> new File(file, s)).map(File::getAbsolutePath).toArray(String[]::new);
     } else {
-      return Files.walk(Paths.get(fileUri)).
+      return Files.walk(Paths.get(file.getAbsolutePath())).

Review comment:
       Any side-effect of this?

##########
File path: pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/PinotFSCommand.java
##########
@@ -0,0 +1,119 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.pinot.tools.admin.command;
+
+import org.apache.pinot.tools.Command;
+import org.apache.pinot.tools.admin.command.fs.CopyCommand;
+import org.apache.pinot.tools.admin.command.fs.CopyToLocalCommand;
+import org.apache.pinot.tools.admin.command.fs.DeleteCommand;
+import org.apache.pinot.tools.admin.command.fs.ExistsCommand;
+import org.apache.pinot.tools.admin.command.fs.IsDirectoryCommand;
+import org.apache.pinot.tools.admin.command.fs.LastModifiedCommand;
+import org.apache.pinot.tools.admin.command.fs.LengthCommand;
+import org.apache.pinot.tools.admin.command.fs.ListFilesCommand;
+import org.apache.pinot.tools.admin.command.fs.MakeDirectoryCommand;
+import org.apache.pinot.tools.admin.command.fs.MoveCommand;
+import org.apache.pinot.tools.admin.command.fs.TouchCommand;
+import org.kohsuke.args4j.Argument;
+import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.spi.SubCommand;
+import org.kohsuke.args4j.spi.SubCommandHandler;
+import org.kohsuke.args4j.spi.SubCommands;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.reflect.Field;
+
+
+/**
+ * Class to implement PinotFS command.
+ *
+ */
+public class PinotFSCommand extends AbstractBaseAdminCommand implements Command {
+  private static final Logger LOGGER = LoggerFactory.getLogger(PinotFSCommand.class);
+
+  //@formatter:off
+  @Argument(handler = SubCommandHandler.class, metaVar = "<subCommand>")
+  @SubCommands({
+    @SubCommand(name = "copy", impl = CopyCommand.class),
+    @SubCommand(name = "copyToLocal", impl = CopyToLocalCommand.class),
+    @SubCommand(name = "delete", impl = DeleteCommand.class),
+    @SubCommand(name = "exists", impl = ExistsCommand.class),
+    @SubCommand(name = "isDirectoy", impl = IsDirectoryCommand.class),
+    @SubCommand(name = "lastModified", impl = LastModifiedCommand.class),
+    @SubCommand(name = "length", impl = LengthCommand.class),
+    @SubCommand(name = "listFiles", impl = ListFilesCommand.class),
+    @SubCommand(name = "makeDirectory", impl = MakeDirectoryCommand.class),
+    @SubCommand(name = "move", impl = MoveCommand.class),
+    @SubCommand(name = "touch", impl = TouchCommand.class),
+  })
+  Command _subCommand;
+  //@formatter:on
+
+  @Option(name = "-help", required = false, help = true, aliases = {"-h", "--h", "--help"}, usage = "Print this message.")
+  private boolean _help = false;
+
+  @Override
+  public boolean getHelp() {
+    return _help;
+  }
+
+  @Override
+  public boolean execute()
+          throws Exception {
+    if ((_subCommand == null) || _help) {
+      printUsage();
+    } else if (_subCommand.getHelp()) {
+      _subCommand.printUsage();
+      return true;
+    }
+    return _subCommand.execute();
+  }
+
+  public void printUsage() {

Review comment:
       Isn't there a `printUsage` in the base class?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] bradengroom commented on pull request #6059: [WIP] Add CLI commands for interacting with PinotFS

Posted by GitBox <gi...@apache.org>.
bradengroom commented on pull request #6059:
URL: https://github.com/apache/incubator-pinot/pull/6059#issuecomment-698700046


   I still need to add tests for this


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] bradengroom commented on pull request #6059: [WIP] Add CLI commands for interacting with PinotFS

Posted by GitBox <gi...@apache.org>.
bradengroom commented on pull request #6059:
URL: https://github.com/apache/incubator-pinot/pull/6059#issuecomment-698700046


   I still need to add tests for this


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org