예제 #1
0
    def update_trello_project_board(self):
        """Update the project cards for projects in ongoing runs
        """

        skip_list_ids = [self.trello.get_list_id(self.trello_board,COMPLETED),
                         self.trello.get_list_id(self.trello_board,ABORTED)]

        from hugin.project_monitor import ProjectMonitor
        pm = ProjectMonitor(self.config)
        runs = self.list_runs()
        for run in runs:

            # check if the run has already been archived and if so, skip it
            if self.trello_board_archive and self.trello.get_card_on_board(self.trello_board_archive,run['name']):
                print("run {} is archived, skipping".format(run['name']))
                continue

            # check if the run is in a list that should be skipped
            card = self.trello.get_card_on_board(self.trello_board,run['name'])
            if card and card.list_id in skip_list_ids:
                print("run {} is in list {}, skipping".format(run['name'],card.list_id))
                continue

            projects = self.get_run_projects(run)
            for project in projects:
                print("Adding run {} to project {}".format(run['name'],project))
                pm.add_run_to_project(project,run)
예제 #2
0
 def check_finish_status(self):
     """Get the runs in given list and check if the transfer is dont to UPPMAX"""
     from hugin.project_monitor import ProjectMonitor
     pm = ProjectMonitor(self.config)
     pm.samplesheet_folders = []
     uppmax_list = self.trello.get_list(self.trello_board,UPPMAX)
     runs = []
     # Gathering required keys for the purpose of this method
     for card in uppmax_list.list_cards():
         run_name = card.name
         miseq = True if re.search(r'-',run_name.split('_')[-1]) else False
         runs.append({
             'name' : run_name,
             'path' : os.path.join(self.config.get('archive_folders'),run_name),
             'date' : run_name.split("_")[0],
             'position' : run_name.split("_")[-1][0] if not miseq else '',
             'flowcell_id' : run_name.split("_")[-1][1:] if not miseq else run_name.split("_")[-1]})
     for run in runs:
         if pm.get_run_status(run):
             self.set_run_completed(run)
예제 #3
0
 def test_add_project_card(self):
     """Add a project card to project board"""
     
     pm = ProjectMonitor(self.config)
     project = "J.Doe_11_01"
     card = pm.add_project_card(project)
     card.fetch()
     self.assertIs(type(card),
                   trello.Card,
                   "Did not get a Card object back")
     
     self.assertFalse(card.closed,
                      "The added card is closed")
     
     lst = pm.trello.get_list(pm.trello_board, "Sequencing")
     self.assertEqual(card.list_id,
                      lst.id,
                      "Card was not added to the expected list")
     
     run = {'name': "Test run 001"}
     pm.add_run_to_project(project, run)
     
     run = {'name': "Test run 002"}
     pm.add_run_to_project(project, run)
예제 #4
0
def monitor(config):
    pm = ProjectMonitor(config)
    pm.update_run_status()
    pm.update_trello_board()
    pm.archive_cards()