コード例 #1
0
 def result_output(self, request):
     """Reports the output of the task corresponding to a task ID."""
     result = get_result_entity(request.task_id)
     output = result.get_command_output_async(0).get_result()
     if output:
         output = output.decode('utf-8', 'replace')
     return swarming_rpcs.TaskOutput(output=output)
コード例 #2
0
 def stdout(self, request):
   """Returns the output of the task corresponding to a task ID."""
   # TODO(maruel): Add streaming. Real streaming is not supported by AppEngine
   # v1.
   # TODO(maruel): Send as raw content instead of encoded. This is not
   # supported by cloud endpoints.
   logging.info('%s', request)
   result = get_result_entity(request.task_id)
   output = result.get_command_output_async(0).get_result()
   if output:
     output = output.decode('utf-8', 'replace')
   return swarming_rpcs.TaskOutput(output=output)
コード例 #3
0
 def stdout(self, request):
     """Returns the output of the task corresponding to a task ID."""
     # TODO(maruel): Add streaming. Real streaming is not supported by AppEngine
     # v1.
     # TODO(maruel): Send as raw content instead of encoded. This is not
     # supported by cloud endpoints.
     logging.debug('%s', request)
     # The result must be fetched to know the right run_result_key to use.
     _, result = _get_request_and_result(request.task_id, _VIEW, True)
     output = result.get_output()
     if output:
         output = output.decode('utf-8', 'replace')
     return swarming_rpcs.TaskOutput(output=output)
コード例 #4
0
 def stdout(self, request):
     """Returns the output of the task corresponding to a task ID."""
     logging.debug('%s', request)
     if not request.length:
         # Maximum content fetched at once, mostly for compatibility with previous
         # behavior. pRPC implementation should limit to a multiple of CHUNK_SIZE
         # (one or two?) for efficiency.
         request.length = 16 * 1000 * 1024
     _, result = _get_request_and_result(request.task_id, _VIEW, True)
     output = result.get_output(request.offset or 0, request.length)
     if output:
         # That was an error, don't do that in pRPC:
         output = output.decode('utf-8', 'replace')
     return swarming_rpcs.TaskOutput(output=output,
                                     state=swarming_rpcs.TaskState(
                                         result.state))