22 lines
479 B
Python
22 lines
479 B
Python
|
import time
|
||
|
import re
|
||
|
|
||
|
disabled_till = 0
|
||
|
|
||
|
def is_background_job_container_name(string):
|
||
|
if type(string) != str:
|
||
|
return False
|
||
|
pattern = r"^clore-default-\d+$"
|
||
|
return bool(re.match(pattern, string))
|
||
|
|
||
|
def temporarly_disable(seconds):
|
||
|
global disabled_till
|
||
|
disabled_till = time.time() + seconds
|
||
|
|
||
|
def enable():
|
||
|
global disabled_till
|
||
|
disabled_till=0
|
||
|
|
||
|
def is_enabled():
|
||
|
global disabled_till
|
||
|
return True if disabled_till < time.time() else False
|