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


Python signal.SIGXCPU屬性代碼示例

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


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

示例1: sig2exc

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGXCPU [as 別名]
def sig2exc(sig, frm):
            """ signal handler """

            error = PilotErrors()
            runJob.setGlobalPilotErrorDiag("!!FAILED!!3000!! SIGTERM Signal %s is caught in child pid=%d!\n" % (sig, os.getpid()))
            tolog(runJob.getGlobalPilotErrorDiag())
            if sig == signal.SIGTERM:
                runJob.setGlobalErrorCode(error.ERR_SIGTERM)
            elif sig == signal.SIGQUIT:
                runJob.setGlobalErrorCode(error.ERR_SIGQUIT)
            elif sig == signal.SIGSEGV:
                runJob.setGlobalErrorCode(error.ERR_SIGSEGV)
            elif sig == signal.SIGXCPU:
                runJob.setGlobalErrorCode(error.ERR_SIGXCPU)
            elif sig == signal.SIGBUS:
                runJob.setGlobalErrorCode(error.ERR_SIGBUS)
            elif sig == signal.SIGUSR1:
                runJob.setGlobalErrorCode(error.ERR_SIGUSR1)
            else:
                runJob.setGlobalErrorCode(error.ERR_KILLSIGNAL)
            runJob.setFailureCode(runJob.getGlobalErrorCode)
            # print to stderr
            print >> sys.stderr, runJob.getGlobalPilotErrorDiag()
            raise SystemError(sig) 
開發者ID:PanDAWMS,項目名稱:pilot,代碼行數:26,代碼來源:RunJobEdison.py

示例2: sig2exc

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGXCPU [as 別名]
def sig2exc(sig, frm):
            """ signal handler """

            error = PilotErrors()
            runJob.setGlobalPilotErrorDiag("!!FAILED!!3000!! SIGTERM Signal %s is caught in child pid=%d!\n" % (sig, os.getpid()))
            tolog(runJob.getGlobalPilotErrorDiag())
            if sig == signal.SIGTERM:
                runJob.setGlobalErrorCode(error.ERR_SIGTERM)
            elif sig == signal.SIGQUIT:
                runJob.setGlobalErrorCode(error.ERR_SIGQUIT)
            elif sig == signal.SIGSEGV:
                runJob.setGlobalErrorCode(error.ERR_SIGSEGV)
            elif sig == signal.SIGXCPU:
                runJob.setGlobalErrorCode(error.ERR_SIGXCPU)
            elif sig == signal.SIGBUS:
                runJob.setGlobalErrorCode(error.ERR_SIGBUS)
            elif sig == signal.SIGUSR1:
                runJob.setGlobalErrorCode(error.ERR_SIGUSR1)
            else:
                runJob.setGlobalErrorCode(error.ERR_KILLSIGNAL)
            runJob.setFailureCode(runJob.getGlobalErrorCode())
            # print to stderr
            print >> sys.stderr, runJob.getGlobalPilotErrorDiag()
            raise SystemError(sig) 
開發者ID:PanDAWMS,項目名稱:pilot,代碼行數:26,代碼來源:RunJob.py

示例3: limitedTime

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGXCPU [as 別名]
def limitedTime(second, func, *args, **kw):
            second = fixTimeout(second)
            old_alarm = signal(SIGXCPU, signalHandler)
            current = getrlimit(RLIMIT_CPU)
            try:
                setrlimit(RLIMIT_CPU, (second, current[1]))
                return func(*args, **kw)
            finally:
                setrlimit(RLIMIT_CPU, current)
                signal(SIGXCPU, old_alarm) 
開發者ID:Yukinoshita47,項目名稱:Yuki-Chan-The-Auto-Pentest,代碼行數:12,代碼來源:timeout.py

示例4: signal_to_string

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGXCPU [as 別名]
def signal_to_string(self, signalNumber):
        if signalNumber < 0:
            signalNumber = signalNumber * -1

        if signalNumber == signal.SIGINT:
            return "SIGINT - Interrupt (Ctrl+C)"
        elif signalNumber == signal.SIGKILL:
            return "SIGKILL - Killed"
        elif signalNumber == signal.SIGTERM:
            return "SIGTERM - Terminated"
        elif signalNumber == signal.SIGSEGV:
            return "SIGSEGV - Segmentation fault"
        elif signalNumber == signal.SIGHUP:
            return "SIGHUP - Hang up"
        elif signalNumber == signal.SIGBUS:
            return "SIGBUS - Bus error"
        elif signalNumber == signal.SIGILL:
            return "SIGILL - Illegal instruction"
        elif signalNumber == signal.SIGFPE:
            return "SIGFPE - Floating point exception"
        elif signalNumber == signal.SIGPIPE:
            return "SIGPIPE - Broken pipe (write to pipe with no readers)"
        elif signalNumber == signal.SIGABRT:
            return "SIGABRT - Called abort()"
        elif signalNumber == signal.SIGXFSZ:
            return "SIGXFSZ - Process created files that were too big."
        elif signalNumber == signal.SIGXCPU:
            return "SIGXCPU - Process used too much CPU time."
        else:
            return "Unknown signal #" + str(signalNumber) 
開發者ID:skuhl,項目名稱:autograder,代碼行數:32,代碼來源:autograder.py

示例5: is_killed_by_sigkill_or_sigxcpu

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGXCPU [as 別名]
def is_killed_by_sigkill_or_sigxcpu(status):
    return status - 128 in [signal.SIGKILL, signal.SIGXCPU] 
開發者ID:StepicOrg,項目名稱:epicbox,代碼行數:4,代碼來源:utils.py

示例6: explain_signal

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGXCPU [as 別名]
def explain_signal(signal_number):
	if signal_number == signal.SIGINT:
		return "Execution was interrupted"
	elif signal_number == signal.SIGFPE:
		return 'Execution stopped by an arithmetic error.\nOften this is caused by division (or %) by zero.'
	elif signal_number == signal.SIGXCPU:
		return "Execution stopped by a CPU time limit."
	elif signal_number == signal.SIGXFSZ:
		return "Execution stopped because too much data written."
	else:
		return "Execution terminated by signal %s" % signal_number 
開發者ID:COMP1511UNSW,項目名稱:dcc,代碼行數:13,代碼來源:drive_gdb.py


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