mc_integration.py 文件源码

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

项目:librarian 作者: HERA-Team 项目源码 文件源码
def note_file_created(self, file_obj):
        """Tell M&C about a new Librarian file. M&C file records can also have null
        obsids, so we don't need to do anything special for maintenance files.

        """
        try:
            self.mc_session.add_lib_file(file_obj.name, file_obj.obsid,
                                         file_obj.create_time_astropy,
                                         file_obj.size / 1024**3)
        except InvalidRequestError as e:
            # This could happen if the file's obsid were not registered in the
            # M&C database. Which shouldn't happen, but ...
            self.error(SEVERE, 'couldn\'t register file %s (obsid %s) with M&C: %s',
                       file_obj.name, file_obj.obsid, e)

        try:
            self.mc_session.commit()
        except SQLAlchemyError as e:
            self.mc_session.rollback()
            self.error(SEVERE, 'could not commit file creation note to the M&C system: %s', e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号