当前位置: 首页>>代码示例>>Python>>正文


Python Job.cancel_jobs_by_user方法代码示例

本文整理汇总了Python中bkr.server.model.Job.cancel_jobs_by_user方法的典型用法代码示例。如果您正苦于以下问题:Python Job.cancel_jobs_by_user方法的具体用法?Python Job.cancel_jobs_by_user怎么用?Python Job.cancel_jobs_by_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bkr.server.model.Job的用法示例。


在下文中一共展示了Job.cancel_jobs_by_user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _remove

# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import cancel_jobs_by_user [as 别名]
    def _remove(self, user, method, **kw):

        if user == identity.current.user:
            raise BX(_('You cannot remove yourself'))

        # cancel all running and queued jobs
        Job.cancel_jobs_by_user(user, 'User %s removed' % user.user_name)

        # Return all systems in use by this user
        for system in System.query.filter(System.user==user):
            reservation = system.open_reservation
            system.unreserve(reservation=reservation, service=method, user=user)
        # Return all loaned systems in use by this user
        for system in System.query.filter(System.loaned==user):
            system.record_activity(user=identity.current.user, service=method,
                    action=u'Changed', field=u'Loaned To',
                    old=u'%s' % system.loaned, new=u'None')
            system.loaned = None
        # Change the owner to the caller
        for system in System.query.filter(System.owner==user):
            system.owner = identity.current.user
            system.record_activity(user=identity.current.user, service=method,
                    action=u'Changed', field=u'Owner',
                    old=u'%s' % user, new=u'%s' % identity.current.user)
        # Finally remove the user
        user.removed=datetime.utcnow()
开发者ID:omps,项目名称:beaker,代码行数:28,代码来源:user.py

示例2: _remove

# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import cancel_jobs_by_user [as 别名]
    def _remove(self, user, method, **kw):

        if user == identity.current.user:
            raise BX(_('You cannot remove yourself'))

        # cancel all running and queued jobs
        Job.cancel_jobs_by_user(user, 'User %s removed' % user.user_name)

        # Return all systems in use by this user
        for system in System.query.filter(System.user==user):
            msg = ''
            try:
                reservation = system.open_reservation
                system.unreserve(reservation=reservation,
                    service=method, user=user)
            except BX, error_msg:
                msg = 'Error: %s Action: %s' % (error_msg,system.release_action)
                system.activity.append(SystemActivity(identity.current.user, method, '%s' % system.release_action, 'Return', '', msg))
                system.activity.append(SystemActivity(identity.current.user, method, 'Returned', 'User', '%s' % user, ''))
开发者ID:ustbgaofan,项目名称:beaker,代码行数:21,代码来源:user.py

示例3: _disable

# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import cancel_jobs_by_user [as 别名]
    def _disable(self, user, method,
                 msg='Your account has been temporarily disabled'):

        # cancel all queued and running jobs
        Job.cancel_jobs_by_user(user, msg)
开发者ID:omps,项目名称:beaker,代码行数:7,代码来源:user.py


注:本文中的bkr.server.model.Job.cancel_jobs_by_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。