コード例 #1
0
ファイル: runly080.py プロジェクト: Acrisel/sequent
def build_flow(run_mode=sqnt.RUN_RESTART,
               step_to_fail=None,
               iteration_to_fail='',
               run_id=None):
    myflow = sqnt.Sequent(
        name=appname,
        run_mode=run_mode,
        run_id=run_id,
        config={
            'sleep_between_loops': 0.05,
            'LOGGING': {
                'logging_level': logging.INFO,
            }
        },
    )

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

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

    s111 = s11.add_step('s111',
                        func=Prog(),
                        kwargs={
                            'progname': 'prog1',
                            'step_to_fail': step_to_fail,
                            'iteration_to_fail': iteration_to_fail,
                        })
    s112 = s11.add_step('s112',
                        func=Prog(),
                        kwargs={
                            'progname': 'prog2',
                            'step_to_fail': step_to_fail,
                            'iteration_to_fail': iteration_to_fail,
                        },
                        requires=((s111, sqnt.STEP_SUCCESS), ))

    s12 = s1.add_step('s12',
                      func=Prog(),
                      kwargs={
                          'progname': 'prog3',
                          'step_to_fail': step_to_fail,
                          'iteration_to_fail': iteration_to_fail,
                      },
                      requires=((s11, sqnt.STEP_SUCCESS), ))

    s2 = myflow.add_step('s2',
                         func=Prog(),
                         kwargs={
                             'progname': 'prog4',
                             'step_to_fail': step_to_fail,
                             'iteration_to_fail': iteration_to_fail,
                         },
                         requires=((s1, sqnt.STEP_SUCCESS), ))
    return myflow
コード例 #2
0
ファイル: runly030.py プロジェクト: pombredanne/sequent
def build_flow(run_mode=seq.RUN_RESTART, param=9, run_id=None):
    myflow = seq.Sequent(name=appname, run_mode=run_mode, run_id=run_id, config={'sleep_between_loops': 0.05, 'LOGGING':{'logging_level':logging.DEBUG}})
    
    s0 = myflow.add_step('s0', repeats=[1], ) 
    
    s1 = s0.add_step('s1', func=square, kwargs={'x': 3}, ) 
    
    s2 = s0.add_step('s2', square_root, kwargs={'x': param}, requires=[(s1,seq.STEP_SUCCESS), ],
                   recovery={seq.STEP_FAILURE: seq.STEP_RERUN,
                             seq.STEP_SUCCESS: seq.STEP_SKIP})
    
    s3 = s0.add_step('s3', divide, kwargs={'x': 9, 'y': 3}, requires=[(s2, seq.STEP_SUCCESS), ])
    
    return myflow
コード例 #3
0
#
##############################################################################

import sequent as seq
import logging
import os
import examples.run_progs as rprogs

appname = os.path.basename(__file__)
logger = logging.getLogger(appname)

config = os.path.abspath('runly.conf')
if config.startswith('/private'):
    config = config[8:]

myflow = seq.Sequent(name=appname, config=config, store='pgdb2', config_tag='SEQUENT',)

s1 = myflow.add_step('s1', repeats=range(2) )

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

s111 = s11.add_step('s111', func=rprogs.prog, kwargs={'progname': 'prog1'}) 
s112 = s11.add_step('s112', func=rprogs.prog, kwargs={'progname': 'prog2',}, 
                  requires=( (s111, seq.STEP_SUCCESS), )) 

s12 = s1.add_step('s12', func=rprogs.prog, kwargs={'progname': 'prog3'}, 
                requires=( (s11, seq.STEP_SUCCESS), ), delay=10, hosts=['ubuntud01_sequent']) 

s2 = myflow.add_step('s2', func=rprogs.prog, kwargs={'progname': 'prog4'}, 
                   requires=( (s1, seq.STEP_SUCCESS), )) 
コード例 #4
0
logger = logging.getLogger(appname)



def prog(progname, success=True):
    logger = logging.getLogger(os.getenv("SEQUENT_LOGGER_NAME"))
    logger.info("doing what %s is doing" % progname)
    
    if not success:
        raise Exception("%s failed" % progname)
    return progname

class StepResource(rp.Resource): pass
rp1=rp.ResourcePool('RP1', resource_cls=StepResource, policy={'resource_limit': 2, }).load()                   

myflow=seq.Sequent(name=appname, config={'sleep_between_loops': 0.05, 'LOGGING': {'logging_level': logging.INFO, }}, )

s1=myflow.add_step('s1', repeats=range(2) )

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

s111=s11.add_step('s111', func=prog, kwargs={'progname': 'prog1'}, acquires=[(rp1, 1), ]) 
s112=s11.add_step('s112', func=prog, kwargs={'progname': 'prog2',}, acquires=[(rp1, 1), ], 
                  requires=( (s111, seq.STEP_SUCCESS), )) 

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

s2=myflow.add_step('s2', func=prog, kwargs={'progname': 'prog4'}, 
                   requires=( (s1, seq.STEP_SUCCESS), )) 
コード例 #5
0
ファイル: runly005.py プロジェクト: Acrisel/sequent
import time
import os
import examples.run_progs as rprogs
from .run_progs import Step


class Prog(Step):
    def main(self, *args, **kwargs):
        return rprogs.prog(*args, **kwargs)


appname = os.path.basename(__file__)
logger = logging.getLogger(appname)

config_file = os.path.abspath('runly.conf')
myflow = seq.Sequent(name=appname)

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

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

s111 = s1.add_step('s111',
                   func=Prog(),
                   kwargs={'progname': 'prog1'},
                   repeats=[
                       1,
                   ])
コード例 #6
0
ファイル: runly002.py プロジェクト: pombredanne/sequent
##############################################################################

import sequent as seq
import logging
import time
import os

appname = os.path.basename(__file__)
logger = logging.getLogger(appname)

import sequent.examples.run_progs as rprogs

config_file = os.path.abspath('runly.conf')

myflow = seq.Sequent(name=appname,
                     config=config_file,
                     store='sqfile00',
                     config_tag='SEQUENT')

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

s11 = s1.add_step('s11',
                  func=rprogs.prog,
                  kwargs={
                      'progname': 'prog11',
                      'success': True
                  },
                  repeats=[
                      1,
                  ])
s12 = s1.add_step('s12',
                  func=rprogs.prog,
コード例 #7
0
ファイル: runly001.py プロジェクト: pombredanne/sequent
#    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
import sequent.examples.run_progs as rprogs

config_file = os.path.abspath('runly.conf')
myflow = seq.Sequent(
    config=config_file,
    store='sqfile00',
    config_tag='SEQUENT',
)

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

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

kwargs111 = {'progname': 'prog111'}
kwargs112 = {'progname': 'prog112'}
kwargs12 = {'progname': 'prog12'}
kwargs2 = {'progname': 'prog2'}
コード例 #8
0
#
#    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

appname = os.path.basename(__file__)
logger = logging.getLogger(appname)

import examples.run_progs as rprogs

myflow = seq.Sequent(name=appname, config={'LOGGING': {'logging_level': 20}})

s11 = myflow.add_step('s11',
                      func=rprogs.prog,
                      kwargs={
                          'progname': 'prog11',
                          'success': True
                      },
                      repeats=[
                          1,
                      ],
                      recovery={
                          seq.STEP_FAILURE: seq.STEP_RERUN,
                          seq.STEP_SUCCESS: seq.STEP_RERUN
                      })
s12 = myflow.add_step('s12',
コード例 #9
0
ファイル: runly050.py プロジェクト: pombredanne/sequent
def build_flow(run_mode=sqnt.RUN_RESTART,
               step_to_fail=None,
               iteration_to_fail='',
               run_id=None):
    myflow = sqnt.Sequent(
        name=appname,
        run_mode=run_mode,
        run_id=run_id,
        config={
            'sleep_between_loops': 0.05,
            'LOGGING': {
                'logging_level': logging.INFO,
            }
        },
    )

    rp1 = vrp.ResourcePool('rp1',
                           resource_cls=Resources1,
                           policy={
                               'resource_limit': 4,
                           })
    rp2 = vrp.ResourcePool('rp2',
                           resource_cls=Resources2,
                           policy={
                               'resource_limit': 4,
                           })

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

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

    s111 = s11.add_step('s111',
                        func=prog,
                        kwargs={
                            'progname': 'prog1',
                            'step_to_fail': step_to_fail,
                            'iteration_to_fail': iteration_to_fail,
                        })
    s112 = s11.add_step('s112',
                        func=prog,
                        kwargs={
                            'progname': 'prog2',
                            'step_to_fail': step_to_fail,
                            'iteration_to_fail': iteration_to_fail,
                        },
                        requires=((s111, sqnt.STEP_SUCCESS), ))

    s12 = s1.add_step('s12',
                      func=prog,
                      kwargs={
                          'progname': 'prog3',
                          'step_to_fail': step_to_fail,
                          'iteration_to_fail': iteration_to_fail,
                      },
                      requires=((s11, sqnt.STEP_SUCCESS), ))

    s2 = myflow.add_step('s2',
                         func=prog,
                         kwargs={
                             'progname': 'prog4',
                             'step_to_fail': step_to_fail,
                             'iteration_to_fail': iteration_to_fail,
                         },
                         requires=((s1, sqnt.STEP_SUCCESS), ))
    return myflow
コード例 #10
0
ファイル: runly002.py プロジェクト: Acrisel/sequent
import sequent as seq
import logging
import time
import os

appname = os.path.basename(__file__)
logger = logging.getLogger(appname)

import examples.run_progs as rprogs

# config_file = os.path.abspath('runly.conf')

#myflow = seq.Sequent(name=appname, config=config_file, store='sqfile00', config_tag='SEQUENT')
myflow = seq.Sequent(name=appname,
                     run_mode=seq.RUN_RECOVER,
                     config={'LOGGING': {
                         'logging_level': 10
                     }})

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

s11 = s1.add_step('s11',
                  func=rprogs.prog,
                  kwargs={
                      'progname': 'prog11',
                      'success': True
                  },
                  repeats=[
                      1,
                  ],
                  recovery={