[APIv2] Refactor job refresh status
The endpoint /jobs/{job_id}/refresh-status has been removed in favor of using a GET on the new /jobs/{job_id} endpoint with parameter. To refresh job status, we can GET on: http://{host:ip}/v2/jobs/{job_id}?refresh_status=True Change-Id: I8674a9f26512702f1732c0fefb230a1c0ab90e1e Partial-Implements: bp v2-api-experimental-impl
This commit is contained in:
parent
9fc6841021
commit
e0477d161c
@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import six
|
||||
|
||||
from sahara.api import acl
|
||||
from sahara.service.api.v2 import jobs as api
|
||||
@ -52,17 +53,11 @@ def jobs_execute(data):
|
||||
@acl.enforce("data-processing:job-executions:get")
|
||||
@v.check_exists(api.get_job_execution, id='job_id')
|
||||
def jobs_get(job_id):
|
||||
result = u.to_wrapped_dict_no_render(api.get_job_execution, job_id)
|
||||
result['engine_job_id'] = result['oozie_job_id']
|
||||
del result['oozie_job_id']
|
||||
return u.render(result)
|
||||
|
||||
|
||||
@rest.get('/jobs/<job_id>/refresh-status')
|
||||
@acl.enforce("data-processing:job-executions:refresh_status")
|
||||
@v.check_exists(api.get_job_execution, id='job_id')
|
||||
def jobs_status(job_id):
|
||||
result = u.to_wrapped_dict_no_render(api.get_job_execution_status, job_id)
|
||||
data = u.get_request_args()
|
||||
refresh_status = six.text_type(
|
||||
data.get('refresh_status', 'false')).lower() == 'true'
|
||||
result = u.to_wrapped_dict_no_render(
|
||||
api.get_job_execution, job_id, refresh_status)
|
||||
result['engine_job_id'] = result['oozie_job_id']
|
||||
del result['oozie_job_id']
|
||||
return u.render(result)
|
||||
|
@ -71,17 +71,16 @@ def execute_job(data):
|
||||
return job_execution
|
||||
|
||||
|
||||
def get_job_execution_status(id):
|
||||
return manager.get_job_status(id)
|
||||
|
||||
|
||||
def job_execution_list(**kwargs):
|
||||
return conductor.job_execution_get_all(context.ctx(),
|
||||
regex_search=True, **kwargs)
|
||||
|
||||
|
||||
def get_job_execution(id):
|
||||
return conductor.job_execution_get(context.ctx(), id)
|
||||
def get_job_execution(id, refresh_status=False):
|
||||
if refresh_status:
|
||||
return manager.get_job_status(id)
|
||||
else:
|
||||
return conductor.job_execution_get(context.ctx(), id)
|
||||
|
||||
|
||||
def cancel_job_execution(id):
|
||||
|
Loading…
Reference in New Issue
Block a user