writes output to the output table

    :param job_id: <str> id of the job
    :param content: <str> output to write
    :param conn:
331127
def write_output(job_id, content, conn=None):
    
    output_job = get_job_by_id(job_id, conn)
    results = {}
    if output_job is not None:
        entry = {
            OUTPUTJOB_FIELD: output_job,
            CONTENT_FIELD: content
        }
        results = RBO.insert(entry, conflict=RDB_REPLACE).run(conn)
    return results
102291
private void writeObject(ObjectOutputStream out) throws IOException {
		super.write(out);
		out.writeUTF(mapredOutputFormat.getClass().getName());
		jobConf.write(out);
	}
797208
def write_output_files(self, fh):
    
    for f in self.__output_files:
        print >>fh, "## Job %s generates output file %s" % (self.__name, f)
954423
def get_job_output(self, job_id):
        
        log.debug("GetJobOutput %r", job_id)
        path = "/%s/jobs/%s/live/out" % (self.account, job_id)
        res, content = self._request(path, "GET")
        if res["status"] != "200":
            raise errors.MantaAPIError(res, content)
        keys = content.splitlines(False)
        return keys
1204140
function write(socket, task, id, fn) {
  session[binary ? 'binary' : 'utf8'](task.size, function message(err, data) {
    var start = socket.last = Date.now();

    socket.send(data, {
      binary: binary,
      mask: masked
    }, function sending(err) {
      if (err) {
        process.send({ type: 'error', message: err.message, concurrent: --concurrent, id: id });

        socket.close();
        delete connections[id];
      }

      if (fn) fn(err);
    });
  });
}
993681
def write_file(file_path, content):
    
    handler = open(file_path, 'w+')
    handler.write(content)
    handler.close()
180135
function Job (client, jobID, module) {
  this.client = client
  this.jobID = jobID
  this.module = module
}
436485
def get_batch_result(self, job_id, batch_id, result_id):
        
        response = requests.get(self._get_batch_result_url(job_id, batch_id, result_id),
                                headers=self._get_session_headers())
        response.raise_for_status()

        return response.content
837174
def add_job_inputs(self, job_id, keys):
        
        log.debug("AddJobInputs %r", job_id)
        path = "/%s/jobs/%s/live/in" % (self.account, job_id)
        body = '\r\n'.join(keys) + '\r\n'
        headers = {
            "Content-Type": "text/plain",
            "Content-Length": str(len(body))
        }
        res, content = self._request(path, "POST", body=body, headers=headers)
        if res["status"] != '204':
            raise errors.MantaAPIError(res, content)
1064413
def write_file(self, filename, content):
        
        with open(filename, 'wb') as f:
            self.log.debug(content)
            f.write(content)
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)
1344141
def send_output(self, value, stdout):
        

        writer = self.writer

        if value is not None:
            writer.write('{!r}\n'.format(value).encode('utf8'))

        if stdout:
            writer.write(stdout.encode('utf8'))

        yield from writer.drain()
494384
def add_tag(context, id, name):
    

    result = job.add_tag(context, id=id, name=name)
    utils.format_output(result, context.format)
122949
public synchronized void write(DataOutput out) throws IOException {
    jobid.write(out);
    out.writeFloat(setupProgress);
    out.writeFloat(mapProgress);
    out.writeFloat(reduceProgress);
    out.writeFloat(cleanupProgress);
    out.writeInt(runState);
    out.writeLong(startTime);
    Text.writeString(out, user);
    WritableUtils.writeEnum(out, priority);
    Text.writeString(out, schedulingInfo);
  }
526122
def show(context, id, job_id):
    

    result = analytic.get(context, id, job_id=job_id)
    utils.format_output(result, context.format)
1315197
private void writeJsonForArchivedJob(PrintWriter wrt, RecentJobEvent jobEvent) {
		
		try {
		
			wrt.write("[");
		
			ManagementGraph jobManagementGraph = jobmanager.getManagementGraph(jobEvent.getJobID());
			
			//Serialize job to json
			wrt.write("{");
			wrt.write("\"jobid\": \"" + jobEvent.getJobID() + "\",");
			wrt.write("\"jobname\": \"" + jobEvent.getJobName()+"\",");
			wrt.write("\"status\": \""+ jobEvent.getJobStatus() + "\",");
			wrt.write("\"SCHEDULED\": "+ jobmanager.getArchive().getJobTime(jobEvent.getJobID(), JobStatus.SCHEDULED) + ",");
			wrt.write("\"RUNNING\": "+ jobmanager.getArchive().getJobTime(jobEvent.getJobID(), JobStatus.RUNNING) + ",");
			wrt.write("\"FINISHED\": "+ jobmanager.getArchive().getJobTime(jobEvent.getJobID(), JobStatus.FINISHED) + ",");
			wrt.write("\"FAILED\": "+ jobmanager.getArchive().getJobTime(jobEvent.getJobID(), JobStatus.FAILED) + ",");
			wrt.write("\"CANCELED\": "+ jobmanager.getArchive().getJobTime(jobEvent.getJobID(), JobStatus.CANCELED) + ",");
			wrt.write("\"CREATED\": " + jobmanager.getArchive().getJobTime(jobEvent.getJobID(), JobStatus.CREATED)+",");

			if (jobEvent.getJobStatus() == JobStatus.FAILED) {
			ManagementGraphIterator managementGraphIterator =  new ManagementGraphIterator(jobManagementGraph,true);
			wrt.write("\"failednodes\": [");
			HashSet<String> map = new HashSet<String>();
			boolean first = true;
			while (managementGraphIterator.hasNext()) {
				ManagementVertex managementVertex = managementGraphIterator.next();
				String instanceName = managementVertex.getInstanceName();
				if (managementVertex.getExecutionState() == ExecutionState.FAILED && !map.contains(instanceName)) {
					if (first) {
						first = false;
					} else {
						wrt.write(",");
					}
					wrt.write("{");
					wrt.write("\"node\": \"" + instanceName + "\",");
					wrt.write("\"message\": \"" + StringUtils.escapeHtml(managementVertex.getOptMessage()) + "\"");
					wrt.write("}");
					map.add(instanceName);
				}
			}
			wrt.write("],");
			}

			// Serialize ManagementGraph to json
			wrt.write("\"groupvertices\": [");
			boolean first = true;
			for(ManagementGroupVertex groupVertex : jobManagementGraph.getGroupVerticesInTopologicalOrder()) {
				//Write seperator between json objects
				if(first) {
					first = false;
				} else {
					wrt.write(","); }
				
				wrt.write(groupVertex.toJson());
				
			}
			wrt.write("],");
			
			// write accumulators
			AccumulatorEvent accumulators = jobmanager.getAccumulatorResults(jobEvent.getJobID());
			Map<String, Object> accMap = AccumulatorHelper.toResultMap(accumulators.getAccumulators());
			
			wrt.write("\n\"accumulators\": [");
			int i = 0;
			for( Entry<String, Object> accumulator : accMap.entrySet()) {
				wrt.write("{ \"name\": \""+accumulator.getKey()+" (" + accumulator.getValue().getClass().getName()+")\","
						+ " \"value\": \""+accumulator.getValue().toString()+"\"}\n");
				if(++i < accMap.size()) {
					wrt.write(",");
				}
			}
			wrt.write("],\n");
			
			wrt.write("\"groupverticetimes\": {");
			first = true;
			for(ManagementGroupVertex groupVertex : jobManagementGraph.getGroupVerticesInTopologicalOrder()) {
				
				if(first) {
					first = false;
				} else {
					wrt.write(","); }
				
				// Calculate start and end time for groupvertex
				long started = Long.MAX_VALUE;
				long ended = 0;
				
				// Take earliest running state and latest endstate of groupmembers
				for(int j = 0; j < groupVertex.getNumberOfGroupMembers(); j++) {
					ManagementVertex vertex = groupVertex.getGroupMember(j);
					
					long running = jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.RUNNING);
					if(running != 0 && running < started) {
						started = running;
					}
					
					long finished = jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FINISHED);
					long canceled = jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.CANCELED);
					long failed = jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FAILED);
					
					if(finished != 0 && finished > ended) {
						ended = finished;
					}
					
					if(canceled != 0 && canceled > ended) {
						ended = canceled;
					}
					
					if(failed != 0 && failed > ended) {
						ended = failed;
					}

				}
				
				wrt.write("\""+groupVertex.getID()+"\": {");
				wrt.write("\"groupvertexid\": \"" + groupVertex.getID() + "\",");
				wrt.write("\"groupvertexname\": \"" + groupVertex + "\",");
				wrt.write("\"STARTED\": "+ started + ",");
				wrt.write("\"ENDED\": "+ ended);
				wrt.write("}");
				
			}

			wrt.write("}");
			
			wrt.write("}");
			
			
		wrt.write("]");
		
		} catch (EofException eof) { // Connection closed by client
			LOG.info("Info server for jobmanager: Connection closed by client, EofException");
		} catch (IOException ioe) { // Connection closed by client	
			LOG.info("Info server for jobmanager: Connection closed by client, IOException");
		} 
		
	}
923528
public void write(DataOutput out) throws IOException {
    Text.writeString(out, jobFile);
    taskId.write(out);
    out.writeInt(partition);
    out.writeInt(numSlotsRequired);
    taskStatus.write(out);
    skipRanges.write(out);
    out.writeBoolean(skipping);
    out.writeBoolean(jobCleanup);
    if (jobCleanup) {
      WritableUtils.writeEnum(out, jobRunStateForCleanup);
    }
    out.writeBoolean(jobSetup);
    Text.writeString(out, username);
    out.writeBoolean(writeSkipRecs);
    out.writeBoolean(taskCleanup);  
    extraData.write(out);
  }