本文整理汇总了Python中oozie.models2.Coordinator.get_data_for_json方法的典型用法代码示例。如果您正苦于以下问题:Python Coordinator.get_data_for_json方法的具体用法?Python Coordinator.get_data_for_json怎么用?Python Coordinator.get_data_for_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.models2.Coordinator
的用法示例。
在下文中一共展示了Coordinator.get_data_for_json方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copy_coordinator
# 需要导入模块: from oozie.models2 import Coordinator [as 别名]
# 或者: from oozie.models2.Coordinator import get_data_for_json [as 别名]
def copy_coordinator(request):
if request.method != 'POST':
raise PopupException(_('A POST request is required.'))
jobs = json.loads(request.POST.get('selection'))
for job in jobs:
doc2 = Document2.objects.get(type='oozie-coordinator2', id=job['id'])
doc = doc2.doc.get()
name = doc2.name + '-copy'
doc2 = doc2.copy(name=name, owner=request.user)
doc.copy(content_object=doc2, name=name, owner=request.user)
coord = Coordinator(document=doc2)
coordinator_data = coord.get_data_for_json()
coordinator_data['name'] = name
_import_workspace(request.fs, request.user, coord)
doc2.update_data(coordinator_data)
doc2.save()
response = {}
request.info(_('Coordinator copied.') if len(jobs) > 1 else _('Coordinator copied.'))
return JsonResponse(response)