Debian Codegraph @

taskflow/examples/resume_many_flows/run_flow.py

raw
1 # Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 import logging
16 import os
17 import sys
18
19 logging.basicConfig(level=logging.ERROR)
20
21 self_dir = os.path.abspath(os.path.dirname(__file__))
22 top_dir = os.path.abspath(
23 os.path.join(self_dir, os.pardir, os.pardir, os.pardir))
24 example_dir = os.path.abspath(os.path.join(self_dir, os.pardir))
25
26 sys.path.insert(0, top_dir)
27 sys.path.insert(0, self_dir)
28 sys.path.insert(0, example_dir)
29
30 import taskflow.engines
31
32 import example_utils # noqa
33 import my_flows # noqa
34
35
36 with example_utils.get_backend() as backend:
37 engine = taskflow.engines.load_from_factory(my_flows.flow_factory,
38 backend=backend)
39 print('Running flow {} {}'.format(engine.storage.flow_name,
40 engine.storage.flow_uuid))
41 engine.run()