Skip to content

Commit

Permalink
#369 - Add reset_interval args to execute_job (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Ross authored Nov 30, 2021
1 parent c4dd28f commit 6d0aace
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 9 additions & 2 deletions brewtils/rest/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,18 +618,25 @@ def post_jobs(self, payload):
"""
return self.session.post(self.job_url, data=payload, headers=self.JSON_HEADERS)

def post_execute_job(self, job_id):
def post_execute_job(self, job_id, reset_interval=False):
# type: (str) -> Response
"""Performs a POST on the Job Execute URL
Args:
job_id: The ID of the Job
reset_interval: Sets interval of job to restart now
Returns:
Request Response object
"""
url_params = {}
if reset_interval:
url_params["reset_interval"] = "True"

return self.session.post(
self.job_url + job_id + "/execute", headers=self.JSON_HEADERS
self.job_url + job_id + "/execute",
headers=self.JSON_HEADERS,
params=url_params,
)

@enable_auth
Expand Down
6 changes: 4 additions & 2 deletions brewtils/rest/easy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,16 +843,18 @@ def resume_job(self, job_id):
"""
return self._patch_job(job_id, [PatchOperation("update", "/status", "RUNNING")])

def execute_job(self, job_id):
def execute_job(self, job_id, reset_interval=False):
"""Execute a Job
Args:
job_id (str): The Job ID
reset_interval (bool): Restarts the job's interval time to now if
the job's trigger is an interval
Returns:
Request: The returned request
"""
return self.client.post_execute_job(job_id)
return self.client.post_execute_job(job_id, reset_interval)

@wrap_response(parse_method="parse_resolvable")
def upload_bytes(self, data):
Expand Down

0 comments on commit 6d0aace

Please sign in to comment.