当前位置: 首页>>代码示例>>Python>>正文


Python Bank.load_session方法代码示例

本文整理汇总了Python中biomaj.bank.Bank.load_session方法的典型用法代码示例。如果您正苦于以下问题:Python Bank.load_session方法的具体用法?Python Bank.load_session怎么用?Python Bank.load_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在biomaj.bank.Bank的用法示例。


在下文中一共展示了Bank.load_session方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_new_session

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_new_session(self):
   '''
   Checks an empty session is created
   '''
   b = Bank('alu')
   b.load_session(UpdateWorkflow.FLOW)
   for key in b.session._session['status'].keys():
     self.assertFalse(b.session.get_status(key))
开发者ID:Nurtal,项目名称:TRASHEXCHANGE,代码行数:10,代码来源:biomaj_tests.py

示例2: test_computed_nofile

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_computed_nofile(self):
   b = Bank('computed2')
   b.load_session(UpdateWorkflow.FLOW)
   b.session.config.set('protocol', 'none')
   b.session.config.set('sub1.files.move', 'flat/test_.*')
   res = b.update(True)
   self.assertTrue(res)
   self.assertTrue(os.path.exists(b.session.get_full_release_directory()+'/sub1/flat/test_100.txt'))
开发者ID:Nurtal,项目名称:TRASHEXCHANGE,代码行数:10,代码来源:biomaj_tests.py

示例3: test_extract_release_from_file_content

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_extract_release_from_file_content(self):
   b = Bank('local')
   b.load_session(UpdateWorkflow.FLOW)
   b.session.config.set('release.file', 'test_100\.txt')
   b.session.config.set('release.regexp', 'Release\s*(\d+)')
   w = UpdateWorkflow(b)
   w.wf_release()
   self.assertTrue(b.session.get('release') == '103')
开发者ID:Nurtal,项目名称:TRASHEXCHANGE,代码行数:10,代码来源:biomaj_tests.py

示例4: test_extract_release_from_file_content

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_extract_release_from_file_content(self):
     b = Bank("local")
     b.load_session(UpdateWorkflow.FLOW)
     b.session.config.set("release.file", "test_100\.txt")
     b.session.config.set("release.regexp", "Release\s*(\d+)")
     w = UpdateWorkflow(b)
     w.wf_release()
     self.assertTrue(b.session.get("release") == "103")
开发者ID:pfem-bioinfo,项目名称:biomaj,代码行数:10,代码来源:biomaj_tests.py

示例5: test_new_session

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_new_session(self):
     """
 Checks an empty session is created
 """
     b = Bank("alu")
     b.load_session(UpdateWorkflow.FLOW)
     for key in b.session._session["status"].keys():
         self.assertFalse(b.session.get_status(key))
开发者ID:pfem-bioinfo,项目名称:biomaj,代码行数:10,代码来源:biomaj_tests.py

示例6: test_remoterelease_check

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_remoterelease_check(self):
     b = Bank('local')
     b.load_session(ReleaseCheckWorkflow.FLOW)
     b.session.config.set('release.file', 'test_(\d+)\.txt')
     b.session.config.set('release.regexp', '')
     workflow = ReleaseCheckWorkflow(b)
     res = workflow.start()
     remoterelease = b.session.get('remoterelease')
     self.assertTrue(remoterelease == '100')
开发者ID:genouest,项目名称:biomaj,代码行数:11,代码来源:biomaj_tests.py

示例7: test_get_release

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_get_release(self):
   '''
   Get release
   '''
   b = Bank('alu')
   b.load_session(UpdateWorkflow.FLOW)
   res = b.update()
   self.assertTrue(b.session.get('update'))
   self.assertTrue(res)
   self.assertTrue(b.session._session['release'] is not None)
开发者ID:Nurtal,项目名称:TRASHEXCHANGE,代码行数:12,代码来源:biomaj_tests.py

示例8: test_get_release

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
 def test_get_release(self):
     """
 Get release
 """
     b = Bank("alu")
     b.load_session(UpdateWorkflow.FLOW)
     res = b.update()
     self.assertTrue(b.session.get("update"))
     self.assertTrue(res)
     self.assertTrue(b.session._session["release"] is not None)
开发者ID:pfem-bioinfo,项目名称:biomaj,代码行数:12,代码来源:biomaj_tests.py

示例9: test_session_reload_notover

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
  def test_session_reload_notover(self):
    '''
    Checks a session is used if present
    '''
    b = Bank('alu')
    for i in range(1,5):
      s = Session('alu', self.config, UpdateWorkflow.FLOW)
      s._session['status'][Workflow.FLOW_INIT] = True
      b.session = s
      b.save_session()

    b = Bank('alu')
    b.load_session(UpdateWorkflow.FLOW)
    self.assertTrue(b.session.get_status(Workflow.FLOW_INIT))
开发者ID:Nurtal,项目名称:TRASHEXCHANGE,代码行数:16,代码来源:biomaj_tests.py

示例10: test_session_reload_notover

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
    def test_session_reload_notover(self):
        """
    Checks a session is used if present
    """
        b = Bank("alu")
        for i in range(1, 5):
            s = Session("alu", self.config, UpdateWorkflow.FLOW)
            s._session["status"][Workflow.FLOW_INIT] = True
            b.session = s
            b.save_session()

        b = Bank("alu")
        b.load_session(UpdateWorkflow.FLOW)
        self.assertTrue(b.session.get_status(Workflow.FLOW_INIT))
开发者ID:pfem-bioinfo,项目名称:biomaj,代码行数:16,代码来源:biomaj_tests.py

示例11: test_session_reload_over

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
  def test_session_reload_over(self):
    """
    Checks a session if is not over
    """
    b = Bank('alu')
    for i in range(1,5):
      s = Session('alu', self.config, UpdateWorkflow.FLOW)
      s._session['status'][Workflow.FLOW_INIT] = True
      s._session['status'][Workflow.FLOW_OVER] = True
      b.session = s
      b.save_session()

    b = Bank('alu')
    b.load_session(UpdateWorkflow.FLOW)
    self.assertFalse(b.session.get_status(Workflow.FLOW_INIT))
开发者ID:genouest,项目名称:biomaj,代码行数:17,代码来源:biomaj_tests.py

示例12: test_fromscratch_update_with_release

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
  def test_fromscratch_update_with_release(self):
      '''
      Try updating twice, at second time, bank should  be updated (force with fromscratch)

      Use case with release defined in release file
      '''
      b = Bank('local')
      b.load_session(UpdateWorkflow.FLOW)
      b.session.config.set('release.file', 'test_(\d+)\.txt')
      b.session.config.set('release.regexp', '')
      w = UpdateWorkflow(b)
      w.wf_release()
      self.assertTrue(b.session.get('release') == '100')
      os.makedirs(b.session.get_full_release_directory())
      w = UpdateWorkflow(b)
      # Reset release
      b.session.set('release', None)
      w.options.fromscratch = True
      w.wf_release()
      self.assertTrue(b.session.get('release') == '100__1')
开发者ID:Nurtal,项目名称:TRASHEXCHANGE,代码行数:22,代码来源:biomaj_tests.py

示例13: test_fromscratch_update_with_release

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]
    def test_fromscratch_update_with_release(self):
        """
      Try updating twice, at second time, bank should  be updated (force with fromscratch)

      Use case with release defined in release file
      """
        b = Bank("local")
        b.load_session(UpdateWorkflow.FLOW)
        b.session.config.set("release.file", "test_(\d+)\.txt")
        b.session.config.set("release.regexp", "")
        w = UpdateWorkflow(b)
        w.wf_release()
        self.assertTrue(b.session.get("release") == "100")
        os.makedirs(b.session.get_full_release_directory())
        w = UpdateWorkflow(b)
        # Reset release
        b.session.set("release", None)
        w.options.fromscratch = True
        w.wf_release()
        self.assertTrue(b.session.get("release") == "100__1")
开发者ID:pfem-bioinfo,项目名称:biomaj,代码行数:22,代码来源:biomaj_tests.py

示例14: main

# 需要导入模块: from biomaj.bank import Bank [as 别名]
# 或者: from biomaj.bank.Bank import load_session [as 别名]

#.........这里部分代码省略.........
                print("Maintenance set to Off")
                sys.exit(0)

        if options.owner:
            if not options.bank:
                print("Bank option is missing")
                sys.exit(1)
            bank = Bank(options.bank, no_log=True)
            bank.set_owner(options.owner)
            sys.exit(0)

        if options.visibility:
            if not options.bank:
                print("Bank option is missing")
                sys.exit(1)
            if options.visibility not in ['public', 'private']:
                print("Valid values are public|private")
                sys.exit(1)
            bank = Bank(options.bank, no_log=True)
            bank.set_visibility(options.visibility)
            print("Do not forget to update accordingly the visibility.default parameter in the configuration file")
            sys.exit(0)

        if options.newdir:
            if not options.bank:
                print("Bank option is missing")
                sys.exit(1)
            if not os.path.exists(options.newdir):
                print("Destination directory does not exists")
            bank = Bank(options.bank, options=options, no_log=True)
            if not bank.bank['production']:
                print("Nothing to move, no production directory")
                sys.exit(0)
            bank.load_session(Workflow.FLOW, None)
            w = Workflow(bank)
            res = w.wf_init()
            if not res:
                sys.exit(1)
            for prod in bank.bank['production']:
                session = bank.get_session_from_release(prod['release'])
                bank.load_session(Workflow.FLOW, session)
                prod_path = bank.session.get_full_release_directory()
                if os.path.exists(prod_path):
                    shutil.move(prod_path, options.newdir)
                prod['data_dir'] = options.newdir
            bank.banks.update({'name': options.bank}, {'$set' : { 'production': bank.bank['production'] }})
            print("Bank production directories moved to " + options.newdir)
            print("WARNING: do not forget to update accordingly the data.dir and dir.version properties")
            w.wf_over()
            sys.exit(0)

        if options.newbank:
            if not options.bank:
                print("Bank option is missing")
                sys.exit(1)
            bank = Bank(options.bank, no_log=True)
            conf_dir = BiomajConfig.global_config.get('GENERAL', 'conf.dir')
            bank_prop_file = os.path.join(conf_dir,options.bank+'.properties')
            config_bank = configparser.SafeConfigParser()
            config_bank.read([os.path.join(conf_dir,options.bank+'.properties')])
            config_bank.set('GENERAL', 'db.name', options.newbank)
            newbank_prop_file = open(os.path.join(conf_dir,options.newbank+'.properties'),'w')
            config_bank.write(newbank_prop_file)
            newbank_prop_file.close()
            bank.banks.update({'name': options.bank}, {'$set' : { 'name': options.newbank }})
            os.remove(bank_prop_file)
开发者ID:Nurtal,项目名称:TRASHEXCHANGE,代码行数:70,代码来源:biomaj-cli.py


注:本文中的biomaj.bank.Bank.load_session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。