Esempio n. 1
0
    def _make_update_task(self, uda_class, cols, prior_state=None):

        # Overall layout here:
        # - task name
        # - serialized agg class
        # - prior state flag 1/0
        # - (optional) serialized prior state
        # - serialized table fragment

        payload = BytesIO()
        msg_writer = wire.PackedMessageWriter(payload)
        msg_writer.string('agg-update')
        msg_writer.string(pickle_dump(uda_class))

        if prior_state is not None:
            msg_writer.uint8(1)
            msg_writer.string(pickle_dump(prior_state))
        else:
            msg_writer.uint8(0)

        writer = IbisTableWriter(cols)

        # Create memory map of the appropriate size
        path = 'task_%s' % guid()
        size = writer.total_size() + payload.tell()
        offset = 0
        mm = SharedMmap(path, size, create=True)
        self.paths_to_delete.append(path)

        mm.write(payload.getvalue())
        writer.write(mm)

        task = IbisTaskMessage(self.lock.semaphore_id, path, offset, size)

        return task, mm
Esempio n. 2
0
    def __init__(self, uda_class, view_name, uda_fields, key_fields=None):
        self.uda_class = uda_class

        self.uda_encoded = base64.b64_encode(pickle_dump(uda_class))

        self.view_name = view_name
        self.uda_fields = uda_fields

        self.key_fields = key_fields
Esempio n. 3
0
    def __init__(self, uda_class, view_name, uda_fields, key_fields=None):
        self.uda_class = uda_class

        self.uda_encoded = base64.b64_encode(pickle_dump(uda_class))

        self.view_name = view_name
        self.uda_fields = uda_fields

        self.key_fields = key_fields
Esempio n. 4
0
    def _write_response(self, agg_inst):
        self.shmem.seek(0)
        self.mark_success()

        serialized_inst = pickle_dump(agg_inst)
        wire.write_string(self.shmem, serialized_inst)
Esempio n. 5
0
    def _write_response(self, agg_inst):
        self.shmem.seek(0)
        self.mark_success()

        serialized_inst = pickle_dump(agg_inst)
        wire.write_string(self.shmem, serialized_inst)