Ejemplo n.º 1
0
  def query_job_updates(
      self,
      role=None,
      job_key=None,
      user=None,
      update_statuses=None,
      update_key=None):
    """Returns all job updates matching the query.

    Arguments:
    role -- job role.
    job_key -- job key.
    user -- user who initiated an update.
    update_statuses -- set of JobUpdateStatus to match.
    update_key -- JobUpdateKey to match.

    Returns response object with all matching job update summaries.
    """
    # TODO(wfarner): Consider accepting JobUpdateQuery in this function instead of kwargs.
    return self._scheduler_proxy.getJobUpdateSummaries(
        JobUpdateQuery(
            role=role,
            jobKey=job_key.to_thrift() if job_key else None,
            user=user,
            updateStatuses=update_statuses,
            key=update_key))
Ejemplo n.º 2
0
 def test_query_job_updates_no_filter(self):
     """Test querying job updates with no filter args."""
     api, mock_proxy = self.mock_api()
     query = JobUpdateQuery()
     api.query_job_updates()
     mock_proxy.getJobUpdateSummaries.assert_called_once_with(query,
                                                              retry=True)
Ejemplo n.º 3
0
 def test_query_job_updates(self):
   """Test querying job updates."""
   api, mock_proxy = self.mock_api()
   job_key = AuroraJobKey("foo", "role", "env", "name")
   query = JobUpdateQuery(
       jobKey=job_key.to_thrift(),
       updateStatuses={JobUpdateStatus.ROLLING_FORWARD})
   api.query_job_updates(job_key=job_key, update_statuses=query.updateStatuses)
   mock_proxy.getJobUpdateSummaries.assert_called_once_with(query)
Ejemplo n.º 4
0
 def test_get_job_update_details(self):
     """Test getting job update details."""
     api, mock_proxy = self.mock_api()
     key = JobUpdateKey(job=JobKey(role="role",
                                   environment="env",
                                   name="name"),
                        id="id")
     api.get_job_update_details(key)
     query = JobUpdateQuery(key=key)
     mock_proxy.getJobUpdateDetails.assert_called_once_with(key, query)
Ejemplo n.º 5
0
    def get_job_update_details(self, key):
        """Gets JobUpdateDetails for the specified job update ID.

    Arguments:
    id -- job update ID.

    Returns a response object with JobUpdateDetails.
    """
        if not isinstance(key, JobUpdateKey):
            raise self.TypeError(
                'Invalid key %r: expected %s but got %s' %
                (key, JobUpdateKey.__name__, key.__class__.__name__))

        query = JobUpdateQuery(key=key)
        return self._scheduler_proxy.getJobUpdateDetails(key, query)
Ejemplo n.º 6
0
  def query_job_updates(self, role=None, job_key=None, user=None, update_statuses=None):
    """Returns all job updates matching the query.

    Arguments:
    role -- job role.
    job_key -- job key.
    user -- user who initiated an update.
    update_statuses -- set of JobUpdateStatus to match.

    Returns response object with all matching job update summaries.
    """
    return self._scheduler_proxy.getJobUpdateSummaries(
        JobUpdateQuery(
            role=role,
            jobKey=job_key.to_thrift() if job_key else None,
            user=user,
            updateStatuses=update_statuses))
Ejemplo n.º 7
0
 def test_getJobUpdateSummaries(self):
     self.mock_thrift_client.getJobUpdateSummaries(
         IsA(JobUpdateQuery)).AndReturn(DEFAULT_RESPONSE)
     self.mox.ReplayAll()
     self.make_scheduler_proxy().getJobUpdateSummaries(JobUpdateQuery())
 def test_getJobUpdateSummaries(self):
     self.mock_thrift_client.getJobUpdateSummaries(IsA(JobUpdateQuery))
     self.mox.ReplayAll()
     self.make_scheduler_proxy().getJobUpdateSummaries(JobUpdateQuery())