예제 #1
0
파일: oqscript.py 프로젝트: bwyss/oq-engine
def list_calculations():
    """Simple UI wrapper around
    :function:`openquake.export.core.get_jobs`. It prints the results in
    a nice way."""
    calcs = export.get_jobs(getpass.getuser())
    if len(calcs) > 0:
        print "ID\tStatus\tDescription"
        for c in calcs:
            print "%s\t%s\t%s" % (c.id, c.status, c.description)
예제 #2
0
파일: oqscript.py 프로젝트: bwyss/oq-engine
def list_calculations():
    """Simple UI wrapper around
    :function:`openquake.export.core.get_jobs`. It prints the results in
    a nice way."""
    calcs = export.get_jobs(getpass.getuser())
    if len(calcs) > 0:
        print 'ID\tStatus\tDescription'
        for c in calcs:
            print '%s\t%s\t%s' % (c.id, c.status, c.description)
예제 #3
0
파일: core_test.py 프로젝트: pslh/oq-engine
    def test_get_jobs(self):
        # Test that :function:`openquake.export.get_jobs` retrieves
        # only _completed_ jobs for the given user, in reverse chrono
        # order.
        self._create_job_profiles(self.user_name)
        self._set_up_complete_jobs()
        self._set_up_incomplete_jobs()

        # expeced values, sorted in reverse chronological order:
        expected = sorted([self.uhs_job, self.cpsha_job_fail],
                          key=lambda x: x.last_update)[::-1]
        actual = list(export.get_jobs(self.user_name))

        self.assertEqual(expected, actual)
예제 #4
0
    def test_get_jobs(self):
        # Test that :function:`openquake.export.get_jobs` retrieves
        # only _completed_ jobs for the given user, in reverse chrono
        # order.
        self._create_job_profiles(self.user_name)
        self._set_up_complete_jobs()
        self._set_up_incomplete_jobs()

        # expeced values, sorted in reverse chronological order:
        expected = sorted([self.uhs_job, self.cpsha_job_fail],
                          key=lambda x: x.last_update)[::-1]
        actual = list(export.get_jobs(self.user_name))

        self.assertEqual(expected, actual)
예제 #5
0
파일: core_test.py 프로젝트: pslh/oq-engine
 def test_get_jobs_no_results_for_user(self):
     # No job records at all for this user.
     self.assertTrue(len(export.get_jobs(self.user_name)) == 0)
예제 #6
0
파일: core_test.py 프로젝트: pslh/oq-engine
    def test_get_jobs_no_completed_jobs(self):
        # No completed jobs for this user.
        self._create_job_profiles(self.user_name)
        self._set_up_incomplete_jobs()

        self.assertTrue(len(export.get_jobs(self.user_name)) == 0)
예제 #7
0
 def test_get_jobs_no_results_for_user(self):
     # No job records at all for this user.
     self.assertTrue(len(export.get_jobs(self.user_name)) == 0)
예제 #8
0
    def test_get_jobs_no_completed_jobs(self):
        # No completed jobs for this user.
        self._create_job_profiles(self.user_name)
        self._set_up_incomplete_jobs()

        self.assertTrue(len(export.get_jobs(self.user_name)) == 0)