Example #1
0
 def list(self, request):
   """Provides list of bots."""
   now = utils.utcnow()
   cursor = datastore_query.Cursor(urlsafe=request.cursor)
   q = bot_management.BotInfo.query().order(bot_management.BotInfo.key)
   bots, cursor, more = q.fetch_page(request.batch_size, start_cursor=cursor)
   return swarming_rpcs.BotList(
       cursor=cursor.urlsafe() if cursor and more else None,
       death_timeout=config.settings().bot_death_timeout_secs,
       items=[message_conversion.bot_info_from_dict(bot.to_dict_with_now(
           now)) for bot in bots],
       now=now)
Example #2
0
 def list(self, request):
     """Provides list of bots."""
     now = utils.utcnow()
     cursor = datastore_query.Cursor(urlsafe=request.cursor)
     q = bot_management.BotInfo.query().order(bot_management.BotInfo.key)
     bots, cursor, more = q.fetch_page(request.limit, start_cursor=cursor)
     return swarming_rpcs.BotList(
         cursor=cursor.urlsafe() if cursor and more else None,
         death_timeout=config.settings().bot_death_timeout_secs,
         items=[
             message_conversion.bot_info_from_dict(
                 bot.to_dict_with_now(now)) for bot in bots
         ],
         limit=request.limit,
         now=now)
Example #3
0
 def get(self, request):
     """Provides BotInfo corresponding to a provided bot_id."""
     bot = get_or_raise(bot_management.get_info_key(request.bot_id))
     entity_dict = bot.to_dict_with_now(utils.utcnow())
     return message_conversion.bot_info_from_dict(entity_dict)
Example #4
0
 def get(self, request):
   """Provides BotInfo corresponding to a provided bot_id."""
   bot = get_or_raise(bot_management.get_info_key(request.bot_id))
   entity_dict = bot.to_dict_with_now(utils.utcnow())
   return message_conversion.bot_info_from_dict(entity_dict)