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)
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)
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)
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)
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)