def postBuildStatusUpdates(dArgs, dBuffer, dConfig): dBuildArgs = {} dMp = MuseProjectDB(db=dConfig['mysql-db'], port=dConfig['mysql-port'], user=dConfig['mysql-user'], passwd=dConfig['mysql-passwd'], loc=dConfig['mysql-loc']) lBuildTypes = dMp.getBuildTypes() for sBuildType in lBuildTypes: dBuildArgs[sBuildType] = False dBuildArgs['projectName'] = dArgs['projectName'] dBuildArgs['projectPath'] = dArgs['projectPath'] dBuildArgs['buildTarPath'] = os.path.join(dArgs['buildPath'], dArgs['tarName']) dBuildArgs['buildTargetPath'] = dArgs['buildTargetPath'] dBuildArgs['builder'] = dArgs['containerName'] dBuildArgs['buildTime'] = dBuffer['buildTime'] #dBuildArgs['dmesg'] = dBuffer['dmesg'] dBuildArgs['version'] = dArgs['version'] dBuildArgs['os'] = dArgs['containerOS'] dBuildArgs['numObjects'] = dBuffer['numObjects'] dBuildArgs['returnCode'] = dBuffer['returnCode'] ### troubleshoot serialization error #dBuildArgs['stdout'] = dBuffer['stdout'] #dBuildArgs['stderr'] = dBuffer['stderr'] dBuildArgs[dArgs['buildType']] = True if dConfig['debug']: debug( 'func: postBuildStatusUpdates() build args prepared for es and mysql ingestion' ) # commit status to elasticsearch oES = Elasticsearch(dConfig['es-instance-locs']) oES.index(index=dConfig['es-file-index-name'], doc_type=dConfig['es-file-index-type'], body=dBuildArgs, timeout="20m", request_timeout=600.) if dConfig['debug']: debug('func: postBuildStatusUpdates() build status ingested into es') # commit status to database dMp.open() dMp.insertIntoBuildStatus(dArgs=dBuildArgs, bDebug=dConfig['debug']) dMp.close() if dConfig['debug']: debug( 'func: postBuildStatusUpdates() build status ingested into mysql')
def postBuildStatusUpdates(dArgs, bjson, dConfig): dBuildArgs = {} dMp = MuseProjectDB(db=dConfig['mysql-db'], port=dConfig['mysql-port'], user=dConfig['mysql-user'], passwd=dConfig['mysql-passwd'], loc=dConfig['mysql-loc']) dBuildArgs['projectName'] = bjson['projectName'] dBuildArgs['projectPath'] = bjson['sourcePath'] dBuildArgs['buildTarPath'] = bjson['builds'][0]['buildTarPath'] dBuildArgs['targets'] = bjson['builds'][0]['targets'] # dBuildArgs['builder'] = bjson['containerName'] dBuildArgs['buildTime'] = bjson['builds'][0]['buildTime'] dBuildArgs['version'] = bjson['builds'][0]['version'] dBuildArgs['os'] = bjson['builds'][0]['os'] dBuildArgs['numObjectsPreBuild'] = bjson['builds'][0]['numObjectsPreBuild'] dBuildArgs['numObjectsPostBuild'] = bjson['builds'][0][ 'numObjectsPostBuild'] dBuildArgs['numObjectsGenerated'] = bjson['builds'][0][ 'numObjectsGenerated'] dBuildArgs['numSources'] = bjson['builds'][0]['numSources'] dBuildArgs['returnCode'] = bjson['builds'][0]['targets'][0]['returnCode'] #debug("BuildArgs: ", dBuildArgs) if dConfig['debug']: debug( 'func: postBuildStatusUpdates() build args prepared for mysql ingestion' ) # commit status to database dMp.open() dMp.insertIntoBuildStatusTargets(dArgs=dBuildArgs, bDebug=dConfig['debug']) dMp.insertIntoBuildStatus(dArgs=dBuildArgs, bDebug=dConfig['debug']) dMp.close() if dConfig['debug']: debug( 'func: postBuildStatusUpdates() build status ingested into mysql')