Exemple #1
0
  def lookup_job(self, molequeue_id, timeout=None):

    params = {'moleQueueId': molequeue_id}

    packet_id = self._next_packet_id()
    jsonrpc = JsonRpc.generate_request(packet_id,
                                      'lookupJob',
                                      params)

    self._send_request(packet_id, jsonrpc)
    response = self._wait_for_response(packet_id, timeout)

    # Timeout
    if response == None:
      return None

    # if we an error occurred then throw an exception
    if 'error' in response:
      exception = JobRequestInformationException(response['id'],
                                                 reponse['error']['data'],
                                                 reponse['error']['code'],
                                                 reponse['error']['message'])
      raise exception

    jobrequest = JsonRpc.json_to_jobrequest(response)

    return jobrequest
Exemple #2
0
    def lookup_job(self, molequeue_id, timeout=None):

        params = {'moleQueueId': molequeue_id}

        packet_id = self._next_packet_id()
        jsonrpc = JsonRpc.generate_request(packet_id, 'lookupJob', params)

        self._send_request(packet_id, jsonrpc)
        response = self._wait_for_response(packet_id, timeout)

        # Timeout
        if response == None:
            return None

        # if we an error occurred then throw an exception
        if 'error' in response:
            exception = JobInformationException(response['id'],
                                                response['error']['data'],
                                                response['error']['code'],
                                                response['error']['message'])
            raise exception

        job = JsonRpc.json_to_job(response)

        return job
Exemple #3
0
  def _send_rpc_kill_request(self, timeout=None):
    params = {}
    packet_id = self._next_packet_id()
    jsonrpc = JsonRpc.generate_request(packet_id, 'rpcKill', params)
    self._send_request(packet_id, jsonrpc)
    response = self._wait_for_response(packet_id, timeout)

    # Timeout
    if response == None:
      return None

    if 'result' in response and 'success' in response['result'] and response['result']['success'] == True:
      return True
    return False
Exemple #4
0
    def request_queue_list_update(self, timeout=None):
        packet_id = self._next_packet_id()

        jsonrpc = JsonRpc.generate_request(packet_id, 'listQueues', None)

        self._send_request(packet_id, jsonrpc)
        response = self._wait_for_response(packet_id, timeout)

        # Timeout
        if response == None:
            return None

        queues = JsonRpc.json_to_queues(response)

        return queues
Exemple #5
0
  def request_queue_list_update(self, timeout=None):
    packet_id = self._next_packet_id()

    jsonrpc = JsonRpc.generate_request(packet_id,
                                       'listQueues',
                                       None)

    self._send_request(packet_id, jsonrpc)
    response = self._wait_for_response(packet_id, timeout)

    # Timeout
    if response == None:
      return None

    queues = JsonRpc.json_to_queues(response)

    return queues
Exemple #6
0
    def submit_job_request(self, request, timeout=None):
        params = JsonRpc.jobrequest_to_json_params(request)
        packet_id = self._next_packet_id()
        jsonrpc = JsonRpc.generate_request(packet_id, 'submitJob', params)

        self._send_request(packet_id, jsonrpc)
        response = self._wait_for_response(packet_id, timeout)

        # Timeout
        if response == None:
            return None

        # if we an error occurred then throw an exception
        if 'error' in response:
            exception = JobRequestException(response['id'],
                                            response['error']['code'],
                                            response['error']['message'])
            raise exception

        # otherwise return the molequeue id
        return response['result']['moleQueueId']
Exemple #7
0
  def submit_job_request(self, request, timeout=None):
    params = JsonRpc.jobrequest_to_json_params(request)
    packet_id = self._next_packet_id()
    jsonrpc = JsonRpc.generate_request(packet_id,
                                      'submitJob',
                                      params)

    self._send_request(packet_id, jsonrpc)
    response = self._wait_for_response(packet_id, timeout)

    # Timeout
    if response == None:
      return None

    # if we an error occurred then throw an exception
    if 'error' in response:
      exception = JobRequestException(response['id'],
                                      response['error']['code'],
                                      response['error']['message'])
      raise exception

    # otherwise return the molequeue id
    return response['result']['moleQueueId']