Ejemplo n.º 1
0
        def walk(fmap, ipset, dpset):
            for k, v in fmap.iteritems():
                # if not an 'arg_#' or intermediate 'non-parameter' - add to dpset
                if 'arg' not in k:
                    if k.startswith('<') and k.endswith('>'):
                        ipset.add(k[1:-1])
                    elif k.startswith('[') and k.endswith(
                            ']'):  # Intermediate 'non parameter' - continue
                        pass
                    else:
                        # dependent parameter
                        dpset.add(AbstractFunction._parse_map_name(k)[1])

                if v is None:
                    continue
                elif isinstance(v, dict):
                    walk(v, ipset, dpset)
                elif v.startswith('<') and v.endswith('>'):
                    # independent parameter
                    ipset.add(AbstractFunction._parse_map_name(v[1:-1])[1])
                elif k.startswith('[') and k.endswith(
                        ']'):  # Intermediate 'non parameter' - continue
                    continue
                else:
                    # dependent parameter
                    dpset.add(AbstractFunction._parse_map_name(v)[1])
Ejemplo n.º 2
0
    def get_pfunc(self,pfid):
        if pfid not in self.resource_objs: 
            raise KeyError('Function %s was not loaded' % pfid)

        func_dump = self.resource_objs[pfid].parameter_function
        pfunc = AbstractFunction.load(func_dump)
        return pfunc
Ejemplo n.º 3
0
    def get_pfunc(self, pfid):
        if pfid not in self.resource_objs:
            raise KeyError('Function %s was not loaded' % pfid)

        func_dump = self.resource_objs[pfid].parameter_function
        pfunc = AbstractFunction.load(func_dump)
        return pfunc
Ejemplo n.º 4
0
 def find_function(self, name):
     res_obj, _ = Container.instance.resource_registry.find_resources(
         name=name, restype=RT.ParameterFunction, id_only=False)
     if res_obj:
         return res_obj[0]._id, AbstractFunction.load(
             res_obj[0].parameter_function)
     else:
         raise KeyError('%s was never loaded' % name)
 def get_parameter_function(cls, parameter_function_id=''):
     '''
     Preferred client-side class method for constructing a parameter function
     '''
     dms_cli = DatasetManagementServiceClient()
     pf_res = dms_cli.read_parameter_function(parameter_function_id=parameter_function_id)
     pf = AbstractFunction.load(pf_res.parameter_function)
     pf._identifier = pf._id
     return pf
 def get_parameter_function(cls, parameter_function_id=''):
     '''
     Preferred client-side class method for constructing a parameter function
     '''
     dms_cli = DatasetManagementServiceClient()
     pf_res = dms_cli.read_parameter_function(
         parameter_function_id=parameter_function_id)
     pf = AbstractFunction.load(pf_res.parameter_function)
     pf._identifier = pf._id
     return pf
Ejemplo n.º 7
0
        def walk(fmap, ipset, dpset):
            for k, v in fmap.iteritems():
                # if not an 'arg_#' or intermediate 'non-parameter' - add to dpset
                if 'arg' not in k:
                    if k.startswith('<') and k.endswith('>'):
                        ipset.add(k[1:-1])
                    elif k.startswith('[') and k.endswith(']'):  # Intermediate 'non parameter' - continue
                        pass
                    else:
                        # dependent parameter
                        dpset.add(AbstractFunction._parse_map_name(k)[1])

                if v is None:
                    continue
                elif isinstance(v, dict):
                    walk(v, ipset, dpset)
                elif v.startswith('<') and v.endswith('>'):
                    # independent parameter
                    ipset.add(AbstractFunction._parse_map_name(v[1:-1])[1])
                elif k.startswith('[') and k.endswith(']'):  # Intermediate 'non parameter' - continue
                    continue
                else:
                    # dependent parameter
                    dpset.add(AbstractFunction._parse_map_name(v)[1])
Ejemplo n.º 8
0
    def _add_graph_node(self, graph, name):
        if name.startswith('<') and name.endswith('>'):
            n = name[1:-1]
            c = 'forestgreen'
        elif name.startswith('[') and name.endswith(']'):
            n = name[1:-1]
            c = 'blue'
        elif name.startswith('!') and name.endswith('!'):
            n = name[1:-1]
            c = 'red'
        else:
            n = name
            c = 'black'

        if ':|:' in n:
            a, n = AbstractFunction._parse_map_name(n)
        else:
            a = ''

        graph.add_node(n, color=c, fontcolor=c)

        return a, n
Ejemplo n.º 9
0
    def _add_graph_node(self, graph, name):
        if name.startswith('<') and name.endswith('>'):
            n = name[1:-1]
            c = 'forestgreen'
        elif name.startswith('[') and name.endswith(']'):
            n = name[1:-1]
            c = 'blue'
        elif name.startswith('!') and name.endswith('!'):
            n = name[1:-1]
            c = 'red'
        else:
            n = name
            c = 'black'

        if ':|:' in n:
            a, n = AbstractFunction._parse_map_name(n)
        else:
            a = ''

        graph.add_node(n, color=c, fontcolor=c)

        return a, n
Ejemplo n.º 10
0
 def find_function(self,name):
     res_obj, _ = Container.instance.resource_registry.find_resources(name=name, restype=RT.ParameterFunction, id_only=False)
     if res_obj:
         return res_obj[0]._id, AbstractFunction.load(res_obj[0].parameter_function)
     else:
         raise KeyError('%s was never loaded' % name)