#NEWLINE# def forwards( self , orm ) : #NEWLINE# #INDENT# ' Find every design and move them into Oozie. ' #NEWLINE# for design in orm . OozieDesign . objects . all ( ) : #NEWLINE# #INDENT# action = convert_jobsub_design ( design ) #NEWLINE# if ( not action ) : #NEWLINE# #INDENT# raise RuntimeError ( ( _ ( 'Cannot convert %s design into an Oozie action.' ) % design . name ) ) #NEWLINE# #UNINDENT# workflow = Workflow . objects . new_workflow ( User . objects . get ( id = design . owner . pk ) ) #NEWLINE# workflow . name = action . name #NEWLINE# workflow . description = design . description #NEWLINE# workflow . managed = False #NEWLINE# workflow . save ( ) #NEWLINE# workflow . start . workflow = workflow #NEWLINE# workflow . start . save ( ) #NEWLINE# workflow . start = Start . objects . get ( id = workflow . start . id ) #NEWLINE# workflow . end . workflow = workflow #NEWLINE# workflow . end . save ( ) #NEWLINE# workflow . end = End . objects . get ( id = workflow . end . id ) #NEWLINE# Kill . objects . create ( name = 'kill' , workflow = action , node_type = Kill . node_type ) #NEWLINE# action . workflow = workflow #NEWLINE# action . save ( ) #NEWLINE# workflow . start . add_node ( action ) #NEWLINE# action . add_node ( workflow . end ) #NEWLINE# workflow . save ( )