當前位置: 首頁>>代碼示例>>Python>>正文


Python Actor.get_dbid方法代碼示例

本文整理匯總了Python中models.Actor.get_dbid方法的典型用法代碼示例。如果您正苦於以下問題:Python Actor.get_dbid方法的具體用法?Python Actor.get_dbid怎麽用?Python Actor.get_dbid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Actor的用法示例。


在下文中一共展示了Actor.get_dbid方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: put

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import get_dbid [as 別名]
 def put(self, actor_id):
     dbid = Actor.get_dbid(g.tenant, actor_id)
     try:
         actor = Actor.from_db(actors_store[dbid])
     except KeyError:
         raise APIException(
             "actor not found: {}'".format(actor_id), 404)
     previous_image = actor.image
     args = self.validate_put(actor)
     args['tenant'] = g.tenant
     update_image = False
     if args['image'] == previous_image:
         args['status'] = actor.status
     else:
         update_image = True
         args['status'] = SUBMITTED
     args['api_server'] = g.api_server
     args['owner'] = g.user
     actor = Actor(**args)
     actors_store[actor.db_id] = actor.to_db()
     if update_image:
         ch = CommandChannel()
         ch.put_cmd(actor_id=actor.db_id, image=actor.image, tenant=args['tenant'])
     # return ok(result={'update_image': str(update_image)},
     #           msg="Actor updated successfully.")
     return ok(result=actor.display(),
               msg="Actor updated successfully.")
開發者ID:TACC,項目名稱:abaco,代碼行數:29,代碼來源:controllers.py

示例2: get

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import get_dbid [as 別名]
 def get(self, actor_id, execution_id):
     def get_hypermedia(actor, exc):
         return {'_links': {'self': '{}/actors/v2/{}/executions/{}/logs'.format(actor.api_server, actor.id, exc.id),
                            'owner': '{}/profiles/v2/{}'.format(actor.api_server, actor.owner),
                            'execution': '{}/actors/v2/{}/executions/{}'.format(actor.api_server, actor.id, exc.id)},
                 }
     dbid = Actor.get_dbid(g.tenant, actor_id)
     try:
         actor = Actor.from_db(actors_store[dbid])
     except KeyError:
         raise APIException(
             "actor not found: {}'".format(actor_id), 404)
     try:
         excs = executions_store[dbid]
     except KeyError:
         raise APIException("No executions found for actor {}.".format(actor_id))
     try:
         exc = Execution.from_db(excs[execution_id])
     except KeyError:
         raise APIException("Execution not found {}.".format(execution_id))
     try:
         logs = logs_store[execution_id]
     except KeyError:
         logs = ""
     result={'logs': logs}
     result.update(get_hypermedia(actor, exc))
     return ok(result, msg="Logs retrieved successfully.")
開發者ID:TACC,項目名稱:abaco,代碼行數:29,代碼來源:controllers.py

示例3: delete

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import get_dbid [as 別名]
 def delete(self, actor_id, ch_name):
     id = Actor.get_dbid(g.tenant, actor_id)
     try:
         worker = Worker.get_worker(id, ch_name)
     except WorkerException as e:
         raise APIException(e.msg, 404)
     shutdown_worker(ch_name)
     return ok(result=None, msg="Worker scheduled to be stopped.")
開發者ID:TACC,項目名稱:abaco,代碼行數:10,代碼來源:controllers.py

示例4: post

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import get_dbid [as 別名]
 def post(self, actor_id):
     id = Actor.get_dbid(g.tenant, actor_id)
     try:
         actor = Actor.from_db(actors_store[id])
     except KeyError:
         raise APIException(
             "actor not found: {}'".format(actor_id), 404)
     args = self.validate_post()
     Execution.add_execution(id, args)
     return ok(result=actor.display(), msg="Actor execution added successfully.")
開發者ID:TACC,項目名稱:abaco,代碼行數:12,代碼來源:controllers.py


注:本文中的models.Actor.get_dbid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。