Esempio n. 1
0
    def test_get_celpp_year_from_path(self):

        # pass in None
        try:
            util.get_celpp_year_from_path(None)
            self.fail('Expected exception')
        except Exception:
            pass

        # pass in empty string
        self.assertEqual(util.get_celpp_year_from_path(''), '0')

        # pass in white space string
        self.assertEqual(util.get_celpp_year_from_path('  '), '0')

        # pass in path ending with year
        self.assertEqual(util.get_celpp_year_from_path('/home/foo/2013'),
                         '2013')

        # pass in path with invalid subdirectory on it
        self.assertEqual(util.get_celpp_year_from_path('/h/f/2013/cheese'),
                         '0')

        # pass in path with valid dataset week on end
        valid_week = os.path.join('h', '2013',
                                  util.DATA_SET_WEEK_PREFIX + '10')
        self.assertEqual(util.get_celpp_year_from_path(valid_week), '2013')
Esempio n. 2
0
    def __init__(self, path, args):
        super(ChallengeDataTask, self).__init__(path, args)
        self.set_name('challengedata')

        # Make stage number one higher then BlastNFilter Stage
        blast = BlastNFilterTask(path, args)
        self.set_stage(blast.get_stage() + 1)

        self.set_status(D3RTask.UNKNOWN_STATUS)
        self._challenge_tarball_filename = None
        self._week_num = util.get_celpp_week_number_from_path(self.get_path())
        self._year = util.get_celpp_year_from_path(self.get_dir())
Esempio n. 3
0
    def _generate_post_evaluation_email_body(self, petask):
        """Creates body of email and subject
        :returns subject,body: as strings
        """
        weekno = util.get_celpp_week_number_from_path(petask.get_path())
        year = util.get_celpp_year_from_path(petask.get_path())

        msg = ('Dear CELPP Admin,\n\nHere is the post evaluation  ' +
               'summary reports for CELPP week ' + str(weekno) + '\n\n')

        msg += petask.get_postevaluation_summary()

        msg += '\n\nSincerely,\n\nCELPP Automation'

        subject = (D3RTask.SUBJECT_LINE_PREFIX + str(year) + ' ' + 'week ' +
                   str(weekno) + ' post evaluation summary report')
        return subject, msg
Esempio n. 4
0
 def get_year(self):
     """Parses year from path passed into constructor
        :returns: year as string
     """
     return util.get_celpp_year_from_path(self._path)