def traced_func(*args, **kwargs): trace_enabled = get_option(_TRACE_CONFIG) if not trace_enabled: return func(*args, **kwargs) else: start = datetime.now() _log_trace(func) res = func(*args, **kwargs) _log_trace(func, start) return res
def traced_func(*args, **kwargs): import ibis # Similar to the pandas backend, it is possible to call this function # without having initialized the configuration option. This can happen # when tests are distributed across multiple processes, for example. ibis.dask trace_enabled = get_option(_TRACE_CONFIG) if not trace_enabled: return func(*args, **kwargs) else: start = datetime.now() _log_trace(func) res = func(*args, **kwargs) _log_trace(func, start) return res
def traced_func(*args, **kwargs): # Unfortunately, this function can be called before the `ibis.pandas` # attribute has ever been accessed, which means the trace configuration # option might never get registered and will raise an error. Accessing # the pandas attribute here forces the option initialization import ibis ibis.pandas trace_enabled = get_option(_TRACE_CONFIG) if not trace_enabled: return func(*args, **kwargs) else: start = datetime.now() _log_trace(func) res = func(*args, **kwargs) _log_trace(func, start) return res