예제 #1
0
def getDeployTrack(grokRemote, nupicRemote, grokBranch, nupicBranch):
  """
    This method gives us the deployTrack, depending upon parameters
    (basically checks if production parameters or not).

    :param grokRemote: URL for Grok remote repository
    :param nupicRemote: URL for NuPIC remote repository
    :param grokBranch:  Grok branch used for current build
    :param nupicBranch: NuPIC branch used for current build

    :returns: A `string` representing the deployment track
    e.g.
    1)
    grokRemote: [email protected]:<user-name>/applications.git
    nupicRemote: [email protected]:numenta/nupic.git
    deployTrack: <user-name>-numenta
    2)
    grokRemote: [email protected]:Numenta/applications.git
    nupicRemote: [email protected]:numenta/nupic.git
    deployTrack: groksolutions

    :rtype: string
  """
  if checkIfSaneProductionParams(grokRemote, nupicRemote, grokBranch,
                                 nupicBranch):
    return getGithubUserName(grokRemote)
  else:
    return (getGithubUserName(grokRemote) +
            "-" + getGithubUserName(nupicRemote))
예제 #2
0
def main(jsonArgs):
  """
    Main function.

    :param jsonArgs: dict of pipeline-json and logLevel, defaults to empty
      dict to make the script work independently and via driver scripts.
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}

    :raises NupicBuildFailed if build fails, or a Generic Exception in all
    other cases.

    :param jsonArgs: dict of  pipeline-json and logLevel
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}
  """
  try:
    pipelineConfig = addAndParseArgs(jsonArgs)

    grokUser = getGithubUserName(pipelineConfig["grokRemote"])
    nupicUser = getGithubUserName(pipelineConfig["nupicRemote"])
    amiName = (grokUser + "-" + pipelineConfig["grokBranch"])
    env = prepareEnv(pipelineConfig["buildWorkspace"], None, os.environ)

    preBuildSetup(env, pipelineConfig)

    builder.buildGrok(env, pipelineConfig, g_logger)
    g_logger.debug("Grok built successfully!")

    deployTrack = getDeployTrack(pipelineConfig["grokRemote"],
                                 pipelineConfig["nupicRemote"],
                                 pipelineConfig["grokBranch"],
                                 pipelineConfig["nupicBranch"])

    pipelineConfig["pipelineParams"]["build"] = {
                              "grokSha": pipelineConfig["grokSha"],
                              "nupicSha": pipelineConfig["nupicSha"],
                              "grokHome": env["GROK_HOME"],
                              "nupicBuildDir": env["NUPIC"].rpartition("/")[0],
                              "deployTrack": deployTrack,
                              "grokDeployTrack": grokUser,
                              "nupicDeployTrack": nupicUser,
                              "amiName": amiName
                            }
    g_logger.debug(pipelineConfig["pipelineParams"])
    if pipelineConfig["pipelineJson"]:
      with open(pipelineConfig["pipelineJson"], 'w') as jsonFile:
        jsonFile.write(json.dumps(pipelineConfig["pipelineParams"],
                       ensure_ascii=False))
  except NupicBuildFailed:
    g_logger.exception("NuPIC building failed")
    raise
  except Exception:
    g_logger.exception("Unknown error occurred in build phase")
    raise
예제 #3
0
def main(jsonArgs):
  """
    Main function.

    :param jsonArgs: dict of pipeline-json and logLevel, defaults to empty
      dict to make the script work independently and via driver scripts.
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}

    :param jsonArgs: dict of  pipeline-json and logLevel
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}
  """
  try:
    pipelineConfig = addAndParseArgs(jsonArgs)

    grokUser = getGithubUserName(pipelineConfig["grokRemote"])
    amiName = (grokUser + "-" + pipelineConfig["grokBranch"])
    env = prepareEnv(pipelineConfig["buildWorkspace"], None, os.environ)

    preBuildSetup(env, pipelineConfig)

    builder.buildGrok(env, pipelineConfig, g_logger)
    g_logger.debug("Grok built successfully!")

    deployTrack = getDeployTrack(pipelineConfig["grokRemote"],
                                 pipelineConfig["grokBranch"])

    pipelineConfig["pipelineParams"]["build"] = {
                              "grokSha": pipelineConfig["grokSha"],
                              "grokHome": env["GROK_HOME"],
                              "deployTrack": deployTrack,
                              "grokDeployTrack": grokUser,
                              "amiName": amiName
                            }
    g_logger.debug(pipelineConfig["pipelineParams"])
    if pipelineConfig["pipelineJson"]:
      with open(pipelineConfig["pipelineJson"], 'w') as jsonFile:
        jsonFile.write(json.dumps(pipelineConfig["pipelineParams"],
                       ensure_ascii=False))
  except Exception:
    g_logger.exception("Unknown error occurred in build phase")
    raise
예제 #4
0
def getDeployTrack(grokRemote, grokBranch):
  """
    This method gives us the deployTrack, depending upon parameters
    (basically checks if production parameters or not).

    :param grokRemote: URL for Grok remote repository
    :param grokBranch:  Grok branch used for current build

    :returns: A `string` representing the deployment track
    e.g.
    1)
    grokRemote: [email protected]:<user-name>/numenta-apps.git
    deployTrack: <user-name>-numenta
    2)
    grokRemote: [email protected]:Numenta/numenta-apps.git
    deployTrack: groksolutions

    :rtype: string
  """
  if checkIfSaneProductionParams(grokRemote, grokBranch):
    return "groksolutions"
  else:
    return getGithubUserName(grokRemote) + "-numenta"