def __init__(self, *args, **kwargs):
    if (args and isinstance(args[0], relational.base)):
        obj = args[0]
        trial_ref = obj.id
    elif args:
        trial_ref = kwargs.get('trial_ref', args[0])
    else:
        trial_ref = kwargs.get('trial_ref', None)
    script = kwargs.get('trial_script', None)
    if ('use_cache' in kwargs):
        cache = kwargs['use_cache']
        kwargs['graph_use_cache'] = kwargs.get('graph_use_cache', cache)
        kwargs['prolog_use_cache'] = kwargs.get('graph_use_cache', cache)
    session = relational.session
    if ((not trial_ref) or (trial_ref == (- 1))):
        obj = Trial.last_trial(script=script, session=session)
        if ('graph_use_cache' not in kwargs):
            kwargs['graph_use_cache'] = False
        if ('prolog_use_cache' not in kwargs):
            kwargs['prolog_use_cache'] = False
    else:
        obj = Trial.load_trial(trial_ref, session=session)
    if (obj is None):
        raise RuntimeError('Trial {} not found'.format(trial_ref))
    super(Trial, self).__init__(obj)
    self.dependency_config = DependencyConfig()
    self.dependency_filter = DependencyFilter(self)
    self.graph = TrialGraph(self)
    self.prolog = TrialProlog(self)
    self.dot = TrialDot(self)
    self.initialize_default(kwargs)
    self._prolog_visitor = None
def __init__(self, *args, **kwargs):
    if (args and isinstance(args[0], relational.base)):
        obj = args[0]
        trial_ref = obj.id
    elif args:
        trial_ref = kwargs.get('trial_ref', args[0])
    else:
        trial_ref = kwargs.get('trial_ref', None)
    script = kwargs.get('trial_script', None)
    if ('use_cache' in kwargs):
        cache = kwargs['use_cache']
        kwargs['graph_use_cache'] = kwargs.get('graph_use_cache', cache)
        kwargs['prolog_use_cache'] = kwargs.get('graph_use_cache', cache)
    session = relational.session
    if ((not trial_ref) or (trial_ref == (- 1))):
        obj = Trial.last_trial(script=script, session=session)
        if ('graph_use_cache' not in kwargs):
            kwargs['graph_use_cache'] = False
        if ('prolog_use_cache' not in kwargs):
            kwargs['prolog_use_cache'] = False
    else:
        obj = Trial.load_trial(trial_ref, session=session)
    if (obj is None):
        raise RuntimeError('Trial {} not found'.format(trial_ref))
    super(Trial, self).__init__(obj)
    self.dependency_config = DependencyConfig()
    self.dependency_filter = DependencyFilter(self)
    self.graph = TrialGraph(self)
    self.prolog = TrialProlog(self)
    self.dot = TrialDot(self)
    self.initialize_default(kwargs)
    self._prolog_visitor = None