def get_results()

in source/client/python/api-v0.1/api/connector.py [0:0]


    def get_results(self, submission_response: dict, timeout_sec=0):
        """This methods get the result associated to a specific submission

        Args:
          submission_response (list): arrays storing the ids of the submission to check
          timeout_sec (int): time after the connection between the client of the HTC grid is killed (Default value = 0)

        Returns:
          str: the result of the submission

        """
        logging.info("Init get_results")
        start_time = time.time()

        session_tasks_count: int = len(submission_response['task_ids'])
        logging.info("session_tasks_count: {}".format(session_tasks_count))
        while True:
            session_results = self.invoke_get_results_lambda({'session_id': submission_response['session_id']})
            logging.info("session_results: {}".format(session_results))
            # print("session_results: {}".format(session_results))

            if 'metadata' in session_results \
                    and session_results['metadata']['tasks_in_response'] == session_tasks_count:
                break
            elif 0 < timeout_sec < time.time() - start_time:
                # We have timed out!
                logging.error("Get Results Timed Out")
                break
            time.sleep(self.__dynamodb_results_pull_intervall)

        for i, completed_task in enumerate(session_results[TASK_STATE_FINISHED]):
            stdout_bytes = self.in_out_manager.get_output_to_bytes(completed_task)
            # print("stdout_bytes: {}".format(stdout_bytes))

            output = base64.b64decode(stdout_bytes).decode('utf-8')

            session_results[TASK_STATE_FINISHED + '_OUTPUT'][i] = output

        logging.info("Finish get_results")
        return session_results