Esempio n. 1
0
def run(command, parser, cl_args, unknown_args):
    """ run the update command """

    Log.debug("Update Args: %s", cl_args)

    # Build jar list
    extra_lib_jars = jars.packing_jars()
    action = "update topology%s" % (' in dry-run mode'
                                    if cl_args["dry_run"] else '')

    # Build extra args
    dict_extra_args = {}
    try:
        dict_extra_args = build_extra_args_dict(cl_args)
    except Exception as err:
        return SimpleResult(Status.InvocationError, err.message)

    # Execute
    if cl_args['deploy_mode'] == config.SERVER_MODE:
        return cli_helper.run_server(command, cl_args, action, dict_extra_args)
    else:
        # Convert extra argument to commandline format and then execute
        list_extra_args = convert_args_dict_to_list(dict_extra_args)
        return cli_helper.run_direct(command, cl_args, action, list_extra_args,
                                     extra_lib_jars)
Esempio n. 2
0
def run(command, parser, cl_args, unknown_args):
    """ run the update command """

    Log.debug("Update Args: %s", cl_args)
    extra_lib_jars = jars.packing_jars()
    action = "update topology%s" % (' in dry-run mode'
                                    if cl_args["dry_run"] else '')

    if cl_args['deploy_mode'] == config.SERVER_MODE:
        dict_extra_args = {
            "component_parallelism": cl_args['component_parallelism']
        }
        if cl_args["dry_run"]:
            dict_extra_args.update({'dry_run': True})
            if "dry_run_format" in cl_args:
                dict_extra_args.update(
                    {"dry_run_format", cl_args["dry_run_format"]})

        return cli_helper.run_server(command, cl_args, action, dict_extra_args)
    else:
        list_extra_args = [
            "--component_parallelism",
            ','.join(cl_args['component_parallelism'])
        ]
        if cl_args["dry_run"]:
            list_extra_args.append('--dry_run')
            if "dry_run_format" in cl_args:
                list_extra_args += [
                    "--dry_run_format", cl_args["dry_run_format"]
                ]

        return cli_helper.run_direct(command, cl_args, action, list_extra_args,
                                     extra_lib_jars)
Esempio n. 3
0
def run(command, parser, cl_args, unknown_args):
    '''
  :param command:
  :param parser:
  :param cl_args:
  :param unknown_args:
  :return:
  '''
    Log.debug("Restart Args: %s", cl_args)
    container_id = cl_args['container-id']

    message = "restart topology"
    if container_id >= 0:
        message = "restart container " + str(container_id) + " of topology"

    if cl_args['deploy_mode'] == config.SERVER_MODE:
        dict_extra_args = {"container_id": str(container_id)}
        return cli_helper.run_server(command,
                                     cl_args,
                                     message,
                                     extra_args=dict_extra_args)
    else:
        list_extra_args = ["--container_id", str(container_id)]
        return cli_helper.run_direct(command,
                                     cl_args,
                                     message,
                                     extra_args=list_extra_args)
Esempio n. 4
0
def run(command, parser, cl_args, unknown_args):
  '''
  :param command:
  :param parser:
  :param cl_args:
  :param unknown_args:
  :return:
  '''
  Log.debug("Restart Args: %s", cl_args)
  container_id = cl_args['container-id']

  if cl_args['deploy_mode'] == config.SERVER_MODE:
    dict_extra_args = {"container_id": str(container_id)}
    return cli_helper.run_server(command, cl_args, "restart topology", extra_args=dict_extra_args)
  else:
    list_extra_args = ["--container_id", str(container_id)]
    return cli_helper.run_direct(command, cl_args, "restart topology", extra_args=list_extra_args)
Esempio n. 5
0
def run(command, parser, cl_args, unknown_args):
  """ run the update command """

  Log.debug("Update Args: %s", cl_args)

  # Build jar list
  extra_lib_jars = jars.packing_jars()
  action = "update topology%s" % (' in dry-run mode' if cl_args["dry_run"] else '')

  # Build extra args
  dict_extra_args = {}
  try:
    dict_extra_args = build_extra_args_dict(cl_args)
  except Exception as err:
    return SimpleResult(Status.InvocationError, err.message)

  # Execute
  if cl_args['deploy_mode'] == config.SERVER_MODE:
    return cli_helper.run_server(command, cl_args, action, dict_extra_args)
  else:
    # Convert extra argument to commandline format and then execute
    list_extra_args = convert_args_dict_to_list(dict_extra_args)
    return cli_helper.run_direct(command, cl_args, action, list_extra_args, extra_lib_jars)