File size: 418 Bytes
347d9a3
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
"""Compute guard: allocated cluster jobs or explicitly enabled local reproduction."""
import os,socket


def ensure_compute():
    if os.environ.get('DISH_ALLOW_LOCAL_RENDER')=='1':return
    if 'debug' not in socket.gethostname().lower() and os.environ.get('KUBERNETES_SERVICE_HOST'):return
    raise RuntimeError('Use an allocated CPU job; on your own reproduction machine explicitly set DISH_ALLOW_LOCAL_RENDER=1')