Runs the initial export.

        This process is expected to take a very long time.

        :param events: iterable of all events in this indico instance
513955
def run_initial_export(self, events):
        
        if self.uploader is None:  # pragma: no cover
            raise NotImplementedError

        uploader = self.uploader(self)
        uploader.run_initial(events)
8677
def _run_events(self, tag, stage=None):
        """"""

        self._run_event_methods(tag, stage)
        self._run_tests(tag, stage)
30965
def process_events(self):
        
        for event in sdl2.ext.get_events():
            if event.type == sdl2.SDL_MOUSEMOTION:
                self.example.mouse_position_event(event.motion.x, event.motion.y)

            elif event.type == sdl2.SDL_MOUSEBUTTONUP:
                # Support left and right mouse button for now
                if  event.button.button in [1, 3]:
                    self.example.mouse_press_event(
                        event.motion.x, event.motion.y,
                        1 if event.button.button == 1 else 2,
                    )

            elif event.type == sdl2.SDL_MOUSEBUTTONDOWN:
                # Support left and right mouse button for now
                if  event.button.button in [1, 3]:
                    self.example.mouse_release_event(
                        event.motion.x, event.motion.y,
                        1 if event.button.button == 1 else 2,
                    )

            elif event.type in [sdl2.SDL_KEYDOWN, sdl2.SDL_KEYUP]:
                if event.key.keysym.sym == sdl2.SDLK_ESCAPE:
                    self.close()

                self.example.key_event(event.key.keysym.sym, event.type)

            elif event.type == sdl2.SDL_QUIT:
                self.close()

            elif event.type == sdl2.SDL_WINDOWEVENT:
                if event.window.event == sdl2.SDL_WINDOWEVENT_RESIZED:
                    self.resize(event.window.data1, event.window.data2)
1308554
def PopEvents(self):
    
    event = self.PopEvent()
    while event:
      yield event
      event = self.PopEvent()
931726
def _ExportEvent(self, output_module, event, deduplicate_events=True):
    
    if event.timestamp != self._export_event_timestamp:
      self._FlushExportBuffer(
          output_module, deduplicate_events=deduplicate_events)
      self._export_event_timestamp = event.timestamp

    self._export_event_heap.PushEvent(event)
577104
def write_events(stream, events):
    '''
    
    '''
    for event in events:
        data = event.SerializeToString()
        len_field = struct.pack('<Q', len(data))
        len_crc = struct.pack('<I', masked_crc(len_field))
        data_crc = struct.pack('<I', masked_crc(data))
        stream.write(len_field)
        stream.write(len_crc)
        stream.write(data)
        stream.write(data_crc)
1012435
def eventloop(cls, custom_actions=[]):
        
        iiter = cls([None], custom_actions=custom_actions, verbose=False)
        print('[IITER] Begining interactive main loop')
        for _ in iiter:
            pass
        return iiter
385630
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)
        self.io_loop = tornado.ioloop.IOLoop()
        with salt.utils.asynchronous.current_ioloop(self.io_loop):
            if self.opts['ipc_mode'] == 'tcp':
                epub_uri = int(self.opts['tcp_master_pub_port'])
                epull_uri = int(self.opts['tcp_master_pull_port'])
            else:
                epub_uri = os.path.join(
                    self.opts['sock_dir'],
                    'master_event_pub.ipc'
                )
                epull_uri = os.path.join(
                    self.opts['sock_dir'],
                    'master_event_pull.ipc'
                )

            self.publisher = salt.transport.ipc.IPCMessagePublisher(
                self.opts,
                epub_uri,
                io_loop=self.io_loop
            )

            self.puller = salt.transport.ipc.IPCMessageServer(
                self.opts,
                epull_uri,
                io_loop=self.io_loop,
                payload_handler=self.handle_publish,
            )

            # Start the master event publisher
            with salt.utils.files.set_umask(0o177):
                self.publisher.start()
                self.puller.start()
                if (self.opts['ipc_mode'] != 'tcp' and (
                        self.opts['publisher_acl'] or
                        self.opts['external_auth'])):
                    os.chmod(os.path.join(
                        self.opts['sock_dir'], 'master_event_pub.ipc'), 0o666)

            # Make sure the IO loop and respective sockets are closed and
            # destroyed
            Finalize(self, self.close, exitpriority=15)

            self.io_loop.start()
450435
def run_forever(self) -> None:
        ''''''

        Log.debug('running event loop until terminated')
        asyncio.ensure_future(self.init())
        self.loop.run_forever()
        self.loop.close()
1363229
def _run(self):
        # type: (SyncCopy) -> None
        
        # mark start
        self._start_time = blobxfer.util.datetime_now()
        logger.info('blobxfer start time: {0}'.format(self._start_time))
        # initialize resume db if specified
        if self._general_options.resume_file is not None:
            self._resume = blobxfer.operations.resume.SyncCopyResumeManager(
                self._general_options.resume_file)
        # initialize download threads
        self._initialize_transfer_threads()
        # iterate through source paths to download
        processed_files = 0
        for src_ase, dst_ase in self._bind_sources_to_destination():
            processed_files += 1
            if self._general_options.dry_run:
                logger.info('[DRY RUN] synccopy: {} -> {}'.format(
                    src_ase.path, dst_ase.path))
            else:
                # add transfer to set
                with self._transfer_lock:
                    self._transfer_set.add(
                        blobxfer.operations.synccopy.SyncCopy.
                        create_unique_transfer_operation_id(src_ase, dst_ase))
                    self._synccopy_total += 1
                    self._synccopy_bytes_total += src_ase.size
                    if blobxfer.util.is_not_empty(dst_ase.replica_targets):
                        self._synccopy_bytes_total += (
                            len(dst_ase.replica_targets) * src_ase.size
                        )
                self._add_to_transfer_queue(src_ase, dst_ase)
        # set remote files processed
        with self._transfer_lock:
            self._all_remote_files_processed = True
            synccopy_size_mib = (
                self._synccopy_bytes_total / blobxfer.util.MEGABYTE
            )
            logger.debug(
                ('{0} remote files to sync, waiting for copy '
                 'completion of approx. {1:.4f} MiB').format(
                     processed_files, synccopy_size_mib))
        del processed_files
        # wait for downloads to complete
        self._wait_for_transfer_threads(terminate=False)
        end_time = blobxfer.util.datetime_now()
        # update progress bar
        self._update_progress_bar()
        # check for exceptions
        if len(self._exceptions) > 0:
            logger.error('exceptions encountered while downloading')
            # raise the first one
            raise self._exceptions[0]
        # check for mismatches
        if (self._synccopy_sofar != self._synccopy_total or
                self._synccopy_bytes_sofar != self._synccopy_bytes_total):
            raise RuntimeError(
                'copy mismatch: [count={}/{} bytes={}/{}]'.format(
                    self._synccopy_sofar, self._synccopy_total,
                    self._synccopy_bytes_sofar, self._synccopy_bytes_total))
        # delete all remaining local files not accounted for if
        # delete extraneous enabled
        self._delete_extraneous_files()
        # delete resume file if we've gotten this far
        if self._resume is not None:
            self._resume.delete()
        # output throughput
        if self._synccopy_start_time is not None:
            dltime = (end_time - self._synccopy_start_time).total_seconds()
            synccopy_size_mib = (
                (self._synccopy_bytes_total << 1) / blobxfer.util.MEGABYTE
            )
            dlmibspeed = synccopy_size_mib / dltime
            logger.info(
                ('elapsed copy time and throughput of {0:.4f} '
                 'GiB: {1:.3f} sec, {2:.4f} Mbps ({3:.3f} MiB/sec)').format(
                     synccopy_size_mib / 1024, dltime, dlmibspeed * 8,
                     dlmibspeed))
        end_time = blobxfer.util.datetime_now()
        logger.info('blobxfer end time: {0} (elapsed: {1:.3f} sec)'.format(
            end_time, (end_time - self._start_time).total_seconds()))
699804
def run(self, target, args=()):
        
        run_event = threading.Event()
        run_event.set()
        thread = threading.Thread(target=target, args=args + (run_event, ))
        self.thread_pool.append(thread)
        self.run_events.append(run_event)
        thread.start()
203721
def from_events(self, instance, ev_args, ctx):
        

        obj = yield from self._process(instance, ev_args, ctx)
        self.__get__(instance, type(instance)).append(obj)
        return obj
207102
def events(self, *events):
        
        return self.send_events(self.create_event(e) for e in events)
1360004
public void run()
    {
        Record record = this.getMainRecord();
        String strFileName = this.getProperty("filename");
        String strImport = this.getProperty("import");
        if (strFileName == null)
            strFileName = strImport;
        String strExport = this.getProperty("export");
        if (strFileName == null)
            strFileName = strExport;
        m_bOverwriteDups = false;
        if ((DBConstants.TRUE.equalsIgnoreCase(this.getProperty("overwritedups")))
            || (DBConstants.YES.equalsIgnoreCase(this.getProperty("overwritedups"))))
                m_bOverwriteDups = true;
        boolean bSuccess = false;
        if (strImport != null)
            bSuccess = this.importXML(record.getTable(), strFileName, null);
        else
            bSuccess = this.exportXML(record.getTable(), strFileName);
        if (!bSuccess)
            System.exit(1);
    }
614903
def initial_export(agent_id, force):
    """"""
    agent = LiveSyncAgent.find_first(id=agent_id)
    if agent is None:
        print 'No such agent'
        return
    if agent.backend is None:
        print cformat('Cannot run agent %{red!}{}%{reset} (backend not found)').format(agent.name)
        return
    print cformat('Selected agent: %{white!}{}%{reset} ({})').format(agent.name, agent.backend.title)
    if agent.initial_data_exported and not force:
        print 'The initial export has already been performed for this agent.'
        print cformat('To re-run it, use %{yellow!}--force%{reset}')
        return

    agent.create_backend().run_initial_export(Event.find(is_deleted=False))
    agent.initial_data_exported = True
    db.session.commit()
314111
def process_join(events)
      events.each do |room, data|
        get_room(room).process_join data
      end
    end
1276297
def process(self, event):
        
        uid = str(uuid.uuid4())
        hostname = os.environ.get('VENT_HOST')
        if not hostname:
            hostname = ''

        try:
            # TODO should directories be treated as bulk paths to send to a
            #      plugin?
            if not event.is_directory:
                spath = event.src_path
                # wait for long copies to finish
                historicalSize = -1
                while (historicalSize != os.path.getsize(spath)):
                    historicalSize = os.path.getsize(spath)
                    time.sleep(0.1)

                if os.path.getsize(spath) == 0:
                    spath = str(spath)
                    print('file drop ignoring empty file: {0}'.format(spath))
                    if spath.startswith('/files/trace_'):
                        key = spath.split('_')[1]
                        # Rabbit settings
                        exchange = 'topic-poseidon-internal'
                        exchange_type = 'topic'
                        routing_key = 'poseidon.algos.decider'

                        message = {}
                        message[key] = {'valid': False, 'source': 'file_drop'}
                        message = json.dumps(message)

                        # Send Rabbit message
                        try:
                            connection = pika.BlockingConnection(
                                pika.ConnectionParameters(host='rabbit')
                            )

                            channel = connection.channel()
                            channel.exchange_declare(
                                exchange=exchange, exchange_type=exchange_type
                            )
                            channel.basic_publish(exchange=exchange,
                                                  routing_key=routing_key,
                                                  body=message)
                            connection.close()
                        except Exception as e:
                            print('failed to send rabbit message because: ' +
                                  str(e))

                    return

                # check if the file was already queued and ignore
                exists = False
                print(uid + ' started ' + spath)
                jobs = self.r.keys(pattern='rq:job*')
                for job in jobs:
                    print(uid + ' ***')
                    description = self.r.hget(
                        job, 'description').decode('utf-8')
                    print(uid + ' ' + description)
                    if description.startswith("watch.file_queue('"):
                        print(uid + ' ' +
                              description.split("watch.file_queue('" +
                                                hostname + '_')[1][:-2])
                        print(uid + ' ' + spath)
                        if description.split("watch.file_queue('" +
                                             hostname +
                                             '_')[1][:-2] == spath:
                            print(uid + ' true')
                            exists = True
                    elif description.startswith("watch.gpu_queue('"):
                        print(uid + ' ' +
                              description.split('"file": "')[1].split('"')[0])
                        print(uid + ' ' + spath)
                        if description.split('"file": "')[1].split('"')[0] == spath:
                            print(uid + ' true')
                            exists = True
                    print(uid + ' ***')

                if not exists:
                    # !! TODO this should be a configuration option in the
                    #         vent.template
                    print(uid + " let's queue it " + spath)
                    # let jobs be queued for up to 30 days
                    self.q.enqueue('watch.file_queue',
                                   hostname + '_' + spath,
                                   ttl=2592000)
                print(uid + ' end ' + spath)
        except Exception as e:  # pragma: no cover
            print('file drop error: ' + str(e))