directorymonitor.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码
def on_created(self, event):
        """Overrides `on_created` in `FileSystemEventHandler` to filter on
        file creation events for `CompletedJobInfo.xml`."""

        if isinstance(event, FileCreatedEvent) and event.src_path.endswith('CompletedJobInfo.xml'):
            logging.info("Observed new run in {}, telling the UI to start uploading it.".format(event.src_path))
            directory = os.path.dirname(event.src_path)
            # tell the UI to clean itself up before observing new runs
            send_message(DirectoryMonitorTopics.new_run_observed)

            # this will send a bunch of events that the UI is listening for, but
            # unlike the UI (which runs this in a separate thread), we're going to do this
            # in our own thread and block on it so we can tell the UI to start
            # uploading once we've finished discovering the run
            find_runs_in_directory(directory)

            # now tell the UI to start
            send_message(DirectoryMonitorTopics.finished_discovering_run)
        else:
            logging.debug("Ignoring file event [{}] with path [{}]".format(str(event), event.src_path))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号