Invokes the /job-xxxx/getLog API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Applets-and-Entry-Points#API-method%3A-%2Fjob-xxxx%2FgetLog
505586
def job_get_log(object_id, input_params={}, always_retry=False, **kwargs):
    
    return DXHTTPRequest('/%s/getLog' % object_id, input_params, always_retry=always_retry, **kwargs)
922779
def gen_job(
        script,
        job_name,
        log_path='qlogs',
        group='km3net',
        platform='cl7',
        walltime='00:10:00',
        vmem='8G',
        fsize='8G',
        shell=None,
        email=None,
        send_mail='n',
        job_array_start=1,
        job_array_stop=None,
        job_array_step=1,
        irods=False,
        sps=True,
        hpss=False,
        xrootd=False,
        dcache=False,
        oracle=False,
        split_array_logs=False
):
    """"""
    if shell is None:
        shell = os.environ['SHELL']
    if email is None:
        email = os.environ['USER'] + '@km3net.de'
    if isinstance(script, Script):
        script = str(script)
    log_path = os.path.join(os.getcwd(), log_path)
    if job_array_stop is not None:
        job_array_option = "#$ -t {}-{}:{}"  \
                           .format(job_array_start, job_array_stop,
                                   job_array_step)
    else:
        job_array_option = "#"
    if split_array_logs:
        task_name = '_$TASK_ID'
    else:
        task_name = ''
    job_string = JOB_TEMPLATE.format(
        script=script,
        email=email,
        send_mail=send_mail,
        log_path=log_path,
        job_name=job_name,
        group=group,
        walltime=walltime,
        vmem=vmem,
        fsize=fsize,
        irods=irods,
        sps=sps,
        hpss=hpss,
        xrootd=xrootd,
        dcache=dcache,
        oracle=oracle,
        shell=shell,
        platform=platform,
        job_array_option=job_array_option,
        task_name=task_name
    )
    return job_string
848795
def statsAndLoggingAggregator(cls, jobStore, stop, config):
        
        #  Overall timing
        startTime = time.time()
        startClock = getTotalCpuTime()

        def callback(fileHandle):
            statsStr = fileHandle.read()
            if not isinstance(statsStr, str):
                statsStr = statsStr.decode()
            stats = json.loads(statsStr, object_hook=Expando)
            try:
                logs = stats.workers.logsToMaster
            except AttributeError:
                # To be expected if there were no calls to logToMaster()
                pass
            else:
                for message in logs:
                    logger.log(int(message.level),
                               'Got message from job at time %s: %s',
                               time.strftime('%m-%d-%Y %H:%M:%S'), message.text)
            try:
                logs = stats.logs
            except AttributeError:
                pass
            else:
                # we may have multiple jobs per worker
                jobNames = logs.names
                messages = logs.messages
                cls.logWithFormatting(jobNames[0], messages,
                                      message='Received Toil worker log. Disable debug level logging to hide this output')
                cls.writeLogFiles(jobNames, messages, config=config)

        while True:
            # This is a indirect way of getting a message to the thread to exit
            if stop.is_set():
                jobStore.readStatsAndLogging(callback)
                break
            if jobStore.readStatsAndLogging(callback) == 0:
                time.sleep(0.5)  # Avoid cycling too fast

        # Finish the stats file
        text = json.dumps(dict(total_time=str(time.time() - startTime),
                               total_clock=str(getTotalCpuTime() - startClock)), ensure_ascii=True)
        jobStore.writeStatsAndLogging(text)
1043340
@Trivial
    public final void logToJobLoggerAndTraceLog(String logMsg) {
        Logger logger = getClassNameLogger();

        JoblogUtil.logRawMsgToJobLogAndTraceOnly(Level.FINE, logMsg, logger);
    }
231563
def handle(job_id, log_level='info', log_file=None):
    
    handlers = [LogDatabaseHandler(job_id)]  # log on db always
    if log_file is None:
        # add a StreamHandler if not already there
        if not any(h for h in logging.root.handlers
                   if isinstance(h, logging.StreamHandler)):
            handlers.append(LogStreamHandler(job_id))
    else:
        handlers.append(LogFileHandler(job_id, log_file))
    for handler in handlers:
        logging.root.addHandler(handler)
    init(job_id, LEVELS.get(log_level, logging.WARNING))
    try:
        yield
    finally:
        # sanity check to make sure that the logging on file is working
        if (log_file and log_file != os.devnull and
                os.path.getsize(log_file) == 0):
            logging.root.warn('The log file %s is empty!?' % log_file)
        for handler in handlers:
            logging.root.removeHandler(handler)
265549
def log_detail(job_id=None, task_name=None, log_id=None):
        
        jobs = get_jobs()
        job = [job for job in jobs if str(job['job_id']) == job_id][0]
        return render_template('log_detail.html',
                               job=job,
                               task_name=task_name,
                               task=[task for task in job['tasks']
                                     if task['name'] == task_name][0],
                               log_id=log_id)
247840
def _get_logs(job_id):
    """"""
    # Avoid SQLAlchemy "Unicode type received non-unicode bind param value"
    # warnings.
    job_id = unicode(job_id)

    results = ENGINE.execute(
        LOGS_TABLE.select().where(LOGS_TABLE.c.job_id == job_id)).fetchall()

    results = [dict(result) for result in results]

    for result in results:
        result.pop("job_id")

    return results
876528
void maybeLogRequest (String uri, String method, Properties parms, Properties header) {
    boolean filterOutRepetitiveStuff = true;

    String log = String.format("%-4s %s", method, uri);
    for( Object arg : parms.keySet() ) {
      String value = parms.getProperty((String) arg);
      if( value != null && value.length() != 0 )
        log += " " + arg + "=" + value;
    }

    Log.info_no_stdout(Sys.HTLOG, log);

    if (filterOutRepetitiveStuff) {
      if (uri.endsWith(".css")) return;
      if (uri.endsWith(".js")) return;
      if (uri.endsWith(".png")) return;
      if (uri.endsWith(".ico")) return;
      if (uri.startsWith("/Typeahead")) return;
      if (uri.startsWith("/2/Typeahead")) return;
      if (uri.endsWith("LogAndEcho.json")) return;
      if (uri.startsWith("/Cloud.json")) return;
      if (uri.contains("Progress")) return;
      if (uri.startsWith("/Jobs.json")) return;
      if (uri.startsWith("/Up.json")) return;
      if (uri.startsWith("/2/WaterMeter")) return;
    }

    Log.info(Sys.HTTPD, log);

    if(header.getProperty("user-agent") != null)
      H2O.GA.postAsync(new AppViewHit(uri).customDimension(H2O.CLIENT_TYPE_GA_CUST_DIM, header.getProperty("user-agent")));
    else
      H2O.GA.postAsync(new AppViewHit(uri));
  }
1094405
function processJob (db, generator, job, webhookOptions) {
  return generator(job.url, job)
    .then(function (response) {
      return _logGeneration(db, job.id, response)
        .then(function (logResponse) {
          if (!error.isError(response)) {
            debug('Job %s was processed, marking job as complete.', job.id)

            return Promise.all([
              _markAsCompleted(db, job.id),
              _setStorage(db, job.id, response.storage)
            ]).then(function () {
              if (!webhookOptions) {
                return response
              }

              // Re-fetch the job as storage has been added
              return getById(db, job.id).then(function (job) {
                // Important to return promise otherwise the npm cli process will exit early
                return attemptPing(db, job, webhookOptions)
                  .then(function() {
                    return response
                  })
              })
            })
          }

          return response
        })
    })
}
1207461
def get_logs_from_db_reading(job_prefix, reading_queue='run_db_reading_queue'):
    """"""
    s3 = boto3.client('s3')
    gen_prefix = 'reading_results/%s/logs/%s' % (job_prefix, reading_queue)
    job_log_data = s3.list_objects_v2(Bucket='bigmech',
                                      Prefix=join(gen_prefix, job_prefix))
    # TODO: Track success/failure
    log_strs = []
    for fdict in job_log_data['Contents']:
        resp = s3.get_object(Bucket='bigmech', Key=fdict['Key'])
        log_strs.append(resp['Body'].read().decode('utf-8'))
    return log_strs
730396
function RestJob(options, context, taskId){
        var self = this;
        self.options = options;
        self.context = context;

        RestJob.super_.call(self, logger, options, context, taskId);
        self.restClient = new HttpTool();
    }
1106809
public com.google.api.Logging getLogging() {
    return logging_ == null ? com.google.api.Logging.getDefaultInstance() : logging_;
  }
331486
def get_log(self, request, response):
        
        return {
            'method': request.method,
            'path': request.get_full_path(),
            'code': response.status_code,
            'time': time.time(),
        }
1200991
private Optional<Long> getMaybeTaskLogReadOffset(final String slaveHostname, final String fullPath, final Long logLength, Optional<SingularityTask> task) {
    long offset = 0;
    long maxOffset = smtpConfiguration.get().getMaxTaskLogSearchOffset();
    Optional<Pattern> maybePattern = getLogErrorRegex(task);
    Pattern pattern;
    if (maybePattern.isPresent()) {
      pattern = maybePattern.get();
    } else {
      LOG.trace("Could not get regex pattern. Reading from bottom of file instead.");
      return getMaybeTaskLogEndOfFileOffset(slaveHostname, fullPath, logLength);
    }
    long length = logLength + pattern.toString().length(); // Get extra so that we can be sure to find the error
    Optional<MesosFileChunkObject> logChunkObject;
    Optional<MesosFileChunkObject> previous = Optional.absent();

    while (offset <= maxOffset) {
      try {
        logChunkObject = sandboxManager.read(slaveHostname, fullPath, Optional.of(offset), Optional.of(length));
      } catch (RuntimeException e) {
        LOG.error("Sandboxmanager failed to read {} on slave {}", fullPath, slaveHostname, e);
        return Optional.absent();
      }
      if (logChunkObject.isPresent()) {
        if (logChunkObject.get().getData().equals("")) { // Passed end of file
          if (previous.isPresent()) { // If there was any log, get the bottom bytes of it
            long end = previous.get().getOffset() + previous.get().getData().length();
            return Optional.of(end - logLength);
          }
          return Optional.absent();
        }
        Matcher matcher = pattern.matcher(logChunkObject.get().getData());
        if (matcher.find()) {
          return Optional.of(offset + matcher.start());
        } else {
          offset += logLength;
        }
      } else { // Couldn't read anything
        LOG.error("Failed to read log file {}", fullPath);
        return Optional.absent();
      }
      previous = logChunkObject;
    }
    LOG.trace("Searched through the first {} bytes of file {} and didn't find an error. Tailing bottom of file instead", maxOffset, fullPath);
    return getMaybeTaskLogEndOfFileOffset(slaveHostname, fullPath, logLength);
  }
553840
@ApiOperation(value="Returns information about a specified job.",
            response=RequestInfoInstance.class, code=200)
    @ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), 
            @ApiResponse(code = 200, message = "Successfull response", examples=@Example(value= {
                    @ExampleProperty(mediaType=JSON, value=GET_REQUEST_RESPONSE_JSON)})) })
    @GET
    @Path(JOB_INSTANCE_GET_URI)
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response getRequestById(@javax.ws.rs.core.Context HttpHeaders headers, 
            @ApiParam(value = "identifier of the asynchronous job to be retrieved", required = true, example = "123") @PathParam("jobId") Long requestId,
            @ApiParam(value = "optional flag that indicats if errors should be loaded as well", required = false) @QueryParam("withErrors") boolean withErrors, 
            @ApiParam(value = "optional flag that indicats if input/output data should be loaded as well", required = false) @QueryParam("withData") boolean withData) {

        Variant v = getVariant(headers);
        String type = getContentType(headers);
        // no container id available so only used to transfer conversation id if given by client
        Header conversationIdHeader = buildConversationIdHeader("", context, headers);
        try {

            String response = executorServiceBase.getRequestById(requestId, withErrors, withData, type);

            return createResponse(response, v, Response.Status.OK, conversationIdHeader);
        } catch (IllegalArgumentException e) {
            return notFound(e.getMessage(), v, conversationIdHeader);
        } catch (Exception e) {
            logger.error("Unexpected error during processing {}", e.getMessage(), e);
            return internalServerError(errorMessage(e), v, conversationIdHeader);
        }
    }
1194216
def _get_job_results(query=None):
    '''
    
    '''
    if not query:
        raise CommandExecutionError("Query parameters cannot be empty.")

    response = __proxy__['panos.call'](query)

    # If the response contains a job, we will wait for the results
    if 'result' in response and 'job' in response['result']:
        jid = response['result']['job']

        while get_job(jid)['result']['job']['status'] != 'FIN':
            time.sleep(5)

        return get_job(jid)
    else:
        return response
526296
public void fetchLogs() {
        try {
            callback.open();
            this.request = getLogRequest(false);
            final HttpResponse response = client.execute(request);
            parseResponse(response);
        } catch (LogCallback.DoneException e) {
            // Signifies we're finished with the log stream.
        } catch (IOException exp) {
            callback.error(exp.getMessage());
        } finally {
            callback.close();
        }
    }