def launch_topology_cmd(topology_name, topology_jar):
     cmd_launch = [
         conf.STORM_BINARY, "-c", "nimbus.host=" + conf.STORM_HOST, " jar ",
         topology_jar, " com.sinfonier.DynamicTopology ",
         str(topology_name)
     ]
     return CommandExecutor.execute(cmd_launch, capture_out=True)
    def compile_python_module(module_name, module_type):
        cmd_launch = [
            "cd", conf.CLASSES_TMP_PATH + ";", conf.JAVA_JAR_BIN, "uf",
            conf.SINFONIER_LAST_JAR, module_type + module_name + ".class"
        ]
        os.remove(conf.CLASSES_TMP_PATH + module_type + module_name + ".class")
        CommandExecutor.execute(cmd_launch, capture_out=True)

        cmd_launch = [
            "cd", conf.CLASSES_TMP_PATH + ";", conf.JAVA_JAR_BIN, "uf",
            conf.SINFONIER_LAST_JAR,
            conf.CLASSES_TMP_PATH_MULTILANG + module_name.lower() + ".py"
        ]
        os.remove(conf.CLASSES_TMP_PATH + conf.CLASSES_TMP_PATH_MULTILANG +
                  module_name + ".class")
        return CommandExecutor.execute(cmd_launch, capture_out=True)
Exemple #3
0
 def remove_local_jar(base_path):
     cmd_launch = [
         conf.MAVEN_BINARY, " -f ",
         os.path.normpath(os.path.join(base_path, 'pom.xml')),
         'dependency:purge-local-repository', '-DactTransitively=false',
         '-DreResolve=false'
     ]
     result = CommandExecutor.execute(cmd_launch, capture_out=True)
     result.log()
     return result
Exemple #4
0
 def build_module_jar(base_path, module_name, version):
     cmd_launch = [
         conf.MAVEN_BINARY, ' -f ',
         os.path.normpath(os.path.join(base_path, 'pom.xml')), 'package',
         '-Djar.finalName=' + module_name + "." + version,
         '-Dstorm.version=' + conf.STORM_VERSION
     ]
     result = CommandExecutor.execute(cmd_launch, capture_out=True)
     result.log()
     return result
 def add_java_module(module_name, module_type):
     cmd_launch = [
         "cd", conf.CLASSES_TMP_PATH + ";", conf.JAVA_JAR_BIN, "uf",
         conf.SINFONIER_LAST_JAR, module_type + module_name + ".class"
     ]
     os.remove(conf.CLASSES_TMP_PATH + module_type + module_name + ".class")
     result = CommandExecutor.execute(cmd_launch, capture_out=True)
     f = open(conf.CLASSES_TMP_PATH + module_type + module_name + ".info")
     listclasses = f.read().splitlines()
     f.close()
     for classjava in listclasses:
         logger.info("Updating JAR with class " + classjava)
         cmd_launch = [
             "cd", conf.CLASSES_TMP_PATH + ";", conf.JAVA_JAR_BIN, "uf",
             conf.SINFONIER_LAST_JAR,
             module_type + classjava.replace("$", "\$")
         ]
         CommandExecutor.execute(cmd_launch, capture_out=True)
         os.remove(conf.CLASSES_TMP_PATH + module_type + classjava)
     os.remove(conf.CLASSES_TMP_PATH + module_type + module_name + ".info")
Exemple #6
0
 def install_jar(base_path, file_name, module, version):
     target = 'deploy:deploy-file' if conf.INTERNAL_MVN_REPOSITORY else 'install:install-file'
     cmd_launch = [
         conf.MAVEN_BINARY, " -f ",
         os.path.normpath(os.path.join(base_path, 'pom.xml')), target,
         '-Dfile=' + file_name, '-DgroupId=com.sinfonier',
         '-DartifactId=' + module, '-Dversion=' + version,
         '-Dpackaging=jar', '-Dstorm.version=' + conf.STORM_VERSION
     ]
     if conf.INTERNAL_MVN_REPOSITORY:
         cmd_launch.append('-DrepositoryId=' + conf.MVN_REPOSITORY_ID)
         cmd_launch.append('-Durl=' + conf.MVN_REPOSITORY_URL)
     result = CommandExecutor.execute(cmd_launch, capture_out=True)
     result.log()
     return result
Exemple #7
0
 def compile_module(base_path, quit_mode=False):
     """
     Clean and compile
     :param base_path: base path file
     :param quit_mode: it's like put -q to mvn
     :return: ProcessResult
     """
     pom_file = os.path.normpath(os.path.join(base_path, 'pom.xml'))
     cmd_launch = conf.MAVEN_BINARY + ' -q ' if quit_mode else ''
     cmd_launch += ' -Dstorm.version=' + conf.STORM_VERSION
     cmd_launch += ' -f ' + pom_file + ' clean compile'
     try:
         return CommandExecutor.execute(cmd_launch, capture_out=True)
     except CommandException as Ex:
         raise ModuleErrorCompilingException(Ex.stderr + Ex.stdout)
Exemple #8
0
    def build_topology_jar(base_path, quit_mode=False):
        """
        Build complete jar with dependencies
        :param base_path: base path file
        :param quit_mode: it's like put -q to mvn
        :return: ProcessResult
        """
        pom_file = os.path.normpath(os.path.join(base_path, 'pom.xml'))
        cmd_launch = conf.MAVEN_BINARY + (' -q ' if quit_mode else '')
        cmd_launch += ' -Dstorm.version=' + conf.STORM_VERSION
        cmd_launch += ' -f ' + pom_file + ' clean compile assembly:single'
        cmd_launch = [cmd_launch]
        if conf.INTERNAL_MVN_REPOSITORY:
            cmd_launch.append('-DrepositoryId=' + conf.MVN_REPOSITORY_ID)
            cmd_launch.append('-Durl=' + conf.MVN_REPOSITORY_URL)

        return CommandExecutor.execute(cmd_launch, capture_out=True)
Exemple #9
0
 def compile_topology(topology_name):
     cmd_launch = [
         conf.MAVEN_BINARY, "-f",
         conf.WORKING_PATH + topology_name + '/pom.xml', 'compile'
     ]
     return CommandExecutor.execute(cmd_launch, capture_out=True)
Exemple #10
0
 def build_topology(workingPath, onlyCompile=False):
     cmd_launch = [
         conf.MAVEN_BINARY, "-f", workingPath + 'pom.xml', 'clean',
         'compile', 'install'
     ]
     return CommandExecutor.execute(cmd_launch, capture_out=True)