Python wrapper for Oozie Webservice REST API. Forked from oozie-webservice-api.
Project description
This is Python Library for Oozie Web service api.
This project follows the [Oozie 4.2.0 WebServicesAPI](https://oozie.apache.org/docs/4.2.0/WebServicesAPI.html) document.
Usage
Install it:
pip install oozie-webservice-api
Usage:
from oozie import OozieWebService
import json
'''
Ooize Web Service Test
@author: hs_seo
@since: 2019.06.18
'''
if __name__ == "__main__":
rerun_xml = '''<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property><name>user.name</name><value>hadoop</value></property>
</configuration>
'''
submit_xml = '''<?xml version="1.0" encoding="UTF-8"?>
<property><name>user.name</name><value>hadoop</value></property>
</configuration>
'''
update_xml = """<configuration>
<property><name>user.name</name><value>hadoop</value></property>
</configuration>"""
# https://oozie.apache.org/docs/4.2.0/WebServicesAPI.html
oozie = OozieWebService("http://localhost:11000")
## Versions - all json return
return_obj = oozie.version.oozie_versions()
## Admin - all json return
return_obj = oozie.admin.status()
return_obj = oozie.admin.status('NORMAL')
return_obj = oozie.admin.os_env()
return_obj = oozie.admin.java_sys_properties()
return_obj = oozie.admin.configuration()
return_obj = oozie.admin.instrumentation()
return_obj = oozie.admin.metrics() # if metric enable
return_obj = oozie.admin.build_version()
return_obj = oozie.admin.available_timezones()
return_obj = oozie.admin.queue_dump()
return_obj = oozie.admin.available_oozie_servers()
return_obj = oozie.admin.list_sharelib()
return_obj = oozie.admin.list_sharelib("pig")
return_obj = oozie.admin.update_sharelib()
## Jobs
#filters = oozie.jobs.Filters()
# Job Submission
return_obj = oozie.jobs.submit_job(submit_xml) # start ok
return_obj = oozie.jobs.submit_job(submit_xml, job_type="mapreduce") # start ok
return_obj = oozie.jobs.info()
return_obj = oozie.jobs.info(filters)
return_obj = oozie.jobs.managing_jobs("kill", "coordinator", filters)
## Job
# Managing a Job
#co_id = "C-ID"
#wf_id = "W-ID"
return_obj = oozie.job.managing_job(wf_id, 'start') # start ok
return_obj = oozie.job.managing_rerun_workflow(wf_id, rerun_xml) # rerun ok
return_obj = oozie.job.rerun_coordinator_on_action(co_id, "1") # rerun ok
return_obj = oozie.job.rerun_coordinator_on_date(co_id, "2019-05-22T16:00Z", "2019-05-22T16:00Z") # rerun ok
return_obj = oozie.job.change_coordinator_concurrency(co_id, 2)
return_obj = oozie.job.change_coordinator_endtime(co_id, "2019-06-02T16:00Z")
return_obj = oozie.job.change_coordinator_pausetime(co_id, "2019-06-01T16:00Z")
return_obj = oozie.job.update_coordinator(co_id, update_xml)
# filter
#filters = oozie.job.Filters()
#filters.len = 100
# Log Fiter
#log_filters = oozie.job.LogFilters()
return_obj = oozie.job.job_info(wf_id)
return_obj = oozie.job.job_info(co_id)
return_obj = oozie.job.job_info(co_id, filters)
return_obj = oozie.job.coordinator_allruns(co_id, "1")
return_obj = oozie.job.coordinator_allruns(co_id, "1", filters)
return_obj = oozie.job.job_definition(wf_id)
return_obj = oozie.job.job_log(wf_id) # txt return
return_obj = oozie.job.job_log(wf_id) # txt return
return_obj = oozie.job.job_log(wf_id, filters=log_filters) # txt return
return_obj = oozie.job.job_log(wf_id, "errorlog") # txt return
return_obj = oozie.job.job_log(wf_id, "auditlog") # txt return
return_obj = oozie.job.job_status(wf_id)
return_obj = oozie.job.job_graph(wf_id, file_over_write=True)
if return_obj.isok:
print(return_obj.info.url)
if "Content-Type" in return_obj.headers and "application/json" in return_obj.headers["Content-Type"]:
json_obj = json.loads(return_obj.body)
print(json.dumps(json_obj, indent=4, sort_keys=True))
else:
print(return_obj.body)
else:
print(return_obj.info.filename)
print(return_obj.info.headers['oozie-error-code'])
print(return_obj.info.headers['oozie-error-message'])
print(return_obj.body)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
oozie-api-1.2.0.tar.gz
(8.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oozie-api-1.2.0.tar.gz.
File metadata
- Download URL: oozie-api-1.2.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bed0df0fe5cd237cb296ccfba28f256c29e1bbb776c4afe4f3edb2421ad9276
|
|
| MD5 |
5f495dff970aaab3b5133b232989ffa3
|
|
| BLAKE2b-256 |
5ea1da4fa886cf7c35ec7e957396f183f8aa80f9fb97e62c76fb9cc630b36d08
|
File details
Details for the file oozie_api-1.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: oozie_api-1.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
926bab1eaec9ca0fd13994a199fb83c736b3e64dc6b9722787401493369eda40
|
|
| MD5 |
3d711c0dacdae819faa5093b7773d681
|
|
| BLAKE2b-256 |
39e988337c801a3214ef2043191320cd134c2c6f0646bde3b8f1a78c1d6b4c4a
|