Exemplo n.º 1
0
def hardware_collection(process, params):

    # Connect to the Control port
    control = PandABoxControl(process, params.hostname, params.port)
    control.start()

    # Create a block updater
    poller = PandABoxPoller(process, control)

    # Get some information about what is available in this PandABox
    blocks_data = control.get_blocks_data()
    blocks = []
    parts = []

    for block_name, block_data in blocks_data.items():
        block_names = []
        if block_data.number == 1:
            block_names.append(block_name)
        else:
            for i in range(block_data.number):
                block_names.append("%s%d" % (block_name, i + 1))
        for bn in block_names:
            mri = "%s-%s" % (params.mriPrefix, bn)
            if block_name == "PCAP" and params.areaDetectorPrefix:
                extra_parts = make_pcap_ad_parts(process,
                                                 params.areaDetectorPrefix)
            else:
                extra_parts = []
            # Make a block
            block = poller.make_panda_block(mri, bn, block_data, extra_parts,
                                            params.areaDetectorPrefix)
            blocks.append(block)
            # Make it's corresponding part
            part = make_child_part(process, bn, mri, params.areaDetectorPrefix)
            parts.append(part)

    # Start polling
    poller.start()

    return blocks, parts
Exemplo n.º 2
0
def PandABox(process, params):

    # Connect to the Control port
    control = PandABoxControl(process, params.hostname, params.port)
    control.start()

    # Create a block updater
    poller = PandABoxPoller(process, control)

    # Get some information about what is available in this PandABox
    blocks_data = control.get_blocks_data()
    parts = OrderedDict()
    ret = []

    for block_name, block_data in blocks_data.items():
        block_names = []
        if block_data.number == 1:
            block_names.append(block_name)
        else:
            for i in range(block_data.number):
                block_names.append("%s%d" % (block_name, i+1))
        for bn in block_names:
            malcolm_name = "%s:%s" % (params.name, bn)
            ret.append(poller.make_panda_block(malcolm_name, bn, block_data))
            part_params = LayoutPart.MethodMeta.prepare_input_map(
                dict(name=bn, child=malcolm_name))
            parts[bn] = LayoutPart(process, part_params)

    # Make a controller
    controller = ManagerController(params.name, process, parts)
    ret.append(controller.block)

    # Start polling
    poller.start()

    return ret
Exemplo n.º 3
0
 def setUp(self, mock_socket):
     self.p = Process("process", SyncFactory("sf"))
     self.c = PandABoxControl(self.p, "h", "p")