def handle_unfinished_uploading()

in ambari-infra-solr-client/src/main/python/solrDataManager.py [0:0]


def handle_unfinished_uploading(solr_kinit_command, hdfs_kinit_command, curl_prefix, working_dir, ignore_unfinished_uploading, skip_date_usage):
  command_json_path = "{0}/command.json".format(working_dir)
  if os.path.isfile(command_json_path):
    with open(command_json_path) as command_file:
      command = json.load(command_file)

    if "upload" in list(command.keys()) and ignore_unfinished_uploading:
      logger.info("Ignoring unfinished uploading left by previous run")
      os.remove(command_json_path)
      return

    if "upload" in list(command.keys()):
      logger.info("Previous run has left unfinished uploading")
      logger.info("You may try to run the program with '-g' or '--ignore-unfinished-uploading' to ignore it if it keeps on failing")

      if command["upload"]["type"] == "solr":
        upload_file_to_solr(solr_kinit_command, curl_prefix, command["upload"]["command"], command["upload"]["upload_file_path"],
                            command["upload"]["solr_output_collection"])
      elif command["upload"]["type"] == "hdfs":
        upload_file_hdfs(hdfs_kinit_command, command["upload"]["command"], command["upload"]["upload_file_path"],
                         command["upload"]["hdfs_path"], command["upload"]["hdfs_user"])
      elif command["upload"]["type"] == "s3":
        upload_file_s3(command["upload"]["command"], command["upload"]["upload_file_path"], command["upload"]["bucket"],
                       command["upload"]["key_prefix"])
      elif command["upload"]["type"] == "local":
        upload_file_local(command["upload"]["command"], command["upload"]["upload_file_path"], command["upload"]["local_path"])
      else:
        logger.warn("Unknown upload type: %s", command["upload"]["type"])
        sys.exit()

    if "delete" in list(command.keys()):
      delete_data(solr_kinit_command, curl_prefix, command["delete"]["command"], command["delete"]["collection"],
                  command["delete"]["filter_field"], command["delete"]["id_field"], command["delete"]["prev_lot_end_value"],
                  command["delete"]["prev_lot_end_id"], skip_date_usage)

    os.remove(command_json_path)