本文整理汇总了Python中oozie.models.Workflow.decompress方法的典型用法代码示例。如果您正苦于以下问题:Python Workflow.decompress方法的具体用法?Python Workflow.decompress怎么用?Python Workflow.decompress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.models.Workflow
的用法示例。
在下文中一共展示了Workflow.decompress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _import_workflows
# 需要导入模块: from oozie.models import Workflow [as 别名]
# 或者: from oozie.models.Workflow import decompress [as 别名]
def _import_workflows(self, directory, managed=True):
for example_directory_name in os.listdir(directory):
if os.path.isdir(os.path.join(directory, example_directory_name)):
with open(os.path.join(directory, example_directory_name, 'workflow.zip')) as fp:
workflow_xml, metadata = Workflow.decompress(fp)
workflow_root = etree.fromstring(workflow_xml)
try:
Workflow.objects.get(name=workflow_root.get('name'), managed=managed)
except Workflow.DoesNotExist:
LOG.info(_("Installing workflow %s") % workflow_root.get('name'))
LOG.debug("Workflow definition:\n%s" % workflow_xml)
workflow = Workflow.objects.new_workflow(owner=self.user)
workflow.is_shared = True
workflow.managed = managed
workflow.name = workflow_root.get('name')
workflow.save()
Workflow.objects.initialize(workflow)
import_workflow_root(workflow=workflow, workflow_definition_root=workflow_root, metadata=metadata, fs=self.fs)
workflow.doc.all().delete() # Delete doc as it messes up the example sharing