 
# -*- encoding: utf-8 -*-
##############################################################################
#
#    Acrisel LTD
#    Copyright (C) 2008- Acrisel (acrisel.com) . All Rights Reserved
#
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see http://www.gnu.org/licenses/.
#
##############################################################################

import sequent as seq
import logging
import os
from sequent_examples import run_progs as rprog

logger = logging.getLogger(__name__)

#config = os.path.abspath('example00.conf')
config=os.path.abspath('example00.conf')
# because OSX adds /var -> /private/var
if config.startswith('/private'):
    config = config[8:]
myflow = seq.Sequent(logging_level=logging.DEBUG, config=config, shared_db=False, store='pgdb2', eventor_config_tag='SEQUENT', )

s1 = myflow.add_step('s1', repeats=[1,2] )

s11 = s1.add_step('s11', repeats=[1,2,])

s111 = s11.add_step('s111', func=rprog.prog, kwargs={'progname': 'prog1'}, hosts=['ubuntud01_sequent']) 
s112 = s11.add_step('s112', func=rprog.prog, kwargs={'progname': 'prog2',}, 
                  requires=( (s111, seq.StepStatus.success), )) 

s12 = s1.add_step('s12', func=rprog.prog, kwargs={'progname': 'prog3'}, 
                requires=( (s11, seq.StepStatus.success), )) 

s2 = myflow.add_step('s2', func=rprog.prog, kwargs={'progname': 'prog4'}, 
                   requires=( (s1, seq.StepStatus.success), )) 

if __name__ == '__main__':
    import multiprocessing as mp
    mp.freeze_support()
    mp.set_start_method('spawn')
    myflow.run()
    #myflow.close()

@@ -1030,16 +1030,17 @@
 as rprog
+s
 %0A%0Alogger
@@ -1254,16 +1254,18 @@
 fig%5B8:%5D%0A
+%0A%0A
 myflow =
@@ -1386,16 +1386,20 @@
 NT', )%0A%0A
+'''%0A
 s1 = myf
@@ -1506,32 +1506,33 @@
 111', func=rprog
+s
 .prog, kwargs=%7B'
@@ -1612,32 +1612,33 @@
 112', func=rprog
+s
 .prog, kwargs=%7B'
@@ -1753,32 +1753,33 @@
 s12', func=rprog
+s
 .prog, kwargs=%7B'
@@ -1900,16 +1900,17 @@
 nc=rprog
+s
 .prog, k
@@ -2003,16 +2003,737 @@
 s), )) %0A
+'''%0As = myflow.add_step('s0', repeats=%5B1,2,%5D)%0A%0As1 = s.add_step('s1', repeats=%5B1,2,%5D)%0As11 = s1.add_step('s11', func=rprogs.prog, kwargs=%7B'progname': 'prog11'%7D) %0As12 = s1.add_step('s12', func=rprogs.prog, kwargs=%7B'progname': 'prog12'%7D, requires=( ( s11, seq.StepStatus.complete ), ))%0A%0As2 = s.add_step('s2', requires=( (s1, seq.StepStatus.complete), ),)%0As21 = s2.add_step('s21', func=rprogs.prog, kwargs=%7B'progname': 'prog21'%7D)%0As22 = s2.add_step('s22', func=rprogs.prog, kwargs=%7B'progname': 'prog21'%7D, requires=( ( s21, seq.StepStatus.complete ), ))%0A%0Ae1 = s.add_event( ( (s1, seq.StepStatus.complete), (s2, seq.StepStatus.complete), ) )%0As3 = s.add_step('s3', func=rprogs.prog, kwargs=%7B'progname': 'prog3'%7D, requires=(e1,))%0A%0A
 %0Aif __na

move create flow from Container