예제 #1
0
파일: core.py 프로젝트: tboch/astroquery
    def list_async_jobs(self, verbose=False):
        """Returns all the asynchronous jobs

        Parameters
        ----------
        verbose : bool, optional, default 'False'
            flag to display information about the process

        Returns
        -------
        A list of Job objects
        """
        subContext = "async"
        response = self.__connHandler.execute_get(subContext)
        if verbose:
            print(response.status, response.reason)
            print(response.getheaders())
        isError = self.__connHandler.check_launch_response_status(response,
                                                                  verbose,
                                                                  200)
        if isError:
            print(response.reason)
            raise requests.exceptions.HTTPError(response.reason)
            return None
        # parse jobs
        jsp = JobListSaxParser(async_job=True)
        jobs = jsp.parseData(response)
        if jobs is not None:
            for j in jobs:
                j.set_connhandler(self.__connHandler)
        return jobs
예제 #2
0
파일: core.py 프로젝트: agroener/astroquery
    def list_async_jobs(self, verbose=False):
        """Returns all the asynchronous jobs

        Parameters
        ----------
        verbose : bool, optional, default 'False'
            flag to display information about the process

        Returns
        -------
        A list of Job objects
        """
        subContext = "async"
        response = self.__connHandler.execute_get(subContext)
        if verbose:
            print(response.status, response.reason)
            print(response.getheaders())
        isError = self.__connHandler.check_launch_response_status(response,
                                                                  verbose,
                                                                  200)
        if isError:
            print(response.reason)
            raise Exception(response.reason)
            return None
        # parse jobs
        jsp = JobListSaxParser(async_job=True)
        jobs = jsp.parseData(response)
        if jobs is not None:
            for j in jobs:
                j.set_connhandler(self.__connHandler)
        return jobs
예제 #3
0
def test_jobs_list_parser():
    fileName = data_path('test_jobs_list.xml')
    file = open(fileName, 'r')
    parser = JobListSaxParser()
    jobs = parser.parseData(file)
    assert len(jobs) == 2
    __check_job(jobs[0], "1479386030738O", "COMPLETED", None)
    __check_job(jobs[1], "14793860307381", "ERROR", None)
    file.close()
예제 #4
0
 def test_jobs_list_parser(self):
     fileName = data_path('test_jobs_list.xml')
     file = open(fileName, 'r')
     parser = JobListSaxParser()
     jobs = parser.parseData(file)
     assert len(jobs) == 2, \
         "Expected table list size: 1, found %d" % len(jobs)
     self.__check_job(jobs[0], "1479386030738O", "COMPLETED", None)
     self.__check_job(jobs[1], "14793860307381", "ERROR", None)
     file.close()
예제 #5
0
 def test_jobs_list_parser(self):
     fileName = data_path('test_jobs_list.xml')
     file = open(fileName, 'r')
     parser = JobListSaxParser()
     jobs = parser.parseData(file)
     assert len(jobs) == 2, \
         "Expected table list size: 1, found %d" % len(jobs)
     self.__check_job(jobs[0], "1479386030738O", "COMPLETED", None)
     self.__check_job(jobs[1], "14793860307381", "ERROR", None)
     file.close()