File movements

In order to rework some of the persistence layer I would
like to move around some of the files first, keeping job
specifics in a jobs folder. Having some of the items which
are root level taskflow items (flow, task) be at the root
of the hiearchy. Also for now until the celery work is
commited move that, since it doesn't make sense in backends
anyway.

Change-Id: If6c149710b40f70d4ec69ee8e523defe8f5e766d
This commit is contained in:
Joshua Harlow
2013-08-15 16:54:00 -07:00
parent 6c309a475d
commit acd545f9c2
34 changed files with 43 additions and 136 deletions

View File

@@ -1,17 +0,0 @@
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging
import traceback as tb
from celery import signals
LOG = logging.getLogger(__name__)
@signals.task_failure.connect
def task_error_handler(signal=None, sender=None, task_id=None,
exception=None, args=None, kwargs=None,
traceback=None, einfo=None):
"""If a task errors out, log all error info"""
LOG.error('Task %s, id: %s, called with args: %s, and kwargs: %s'
'failed with exception: %s' % (sender.name, task_id,
args, kwargs, exception))
LOG.error('Trackeback: %s' % (tb.print_tb(traceback), ))
# TODO(jlucci): Auto-initiate rollback from failed task
@signals.task_success.connect
def task_success_handler(singal=None, sender=None, result=None):
"""Save task results to WF."""
pass

View File

@@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
""" Celery Configuration File """
import logging
from taskflow.common import config
from oslo.config import cfg
config.register_celery_opts()
LOG = logging.getLogger(__name__)
BROKER_URL = cfg.CFG('celery_mq')
CELERY_RESULT_BACKEND = "database"
CELERY_RESULT_DBURI = cfg.CFG('celery_backend')

View File

@@ -26,7 +26,7 @@ from taskflow import exceptions as exc
from taskflow import states
from taskflow import utils
from taskflow.generics import flow
from taskflow import flow
LOG = logging.getLogger(__name__)

View File

@@ -2,7 +2,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
# Copyright (C) 2013 Rackspace Hosting All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -2,7 +2,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
# Copyright (C) 2013 Rackspace Hosting All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -38,8 +38,9 @@ CONF.register_opts(db_opts)
CONF.register_opts(mem_opts)
IMPL = utils.LazyPluggable('mem_backend',
memory='taskflow.backends.memory.api',
sqlalchemy='taskflow.backends.sqlalchemy.api')
memory='taskflow.persistence.backends.memory.api',
sqlalchemy='taskflow.persistence.backends'
'.sqlalchemy.api')
def configure(pivot='mem_backend'):

View File

@@ -21,11 +21,11 @@
import logging
from taskflow.backends.memory import memory
from taskflow import exceptions as exception
from taskflow.generics import flowdetail
from taskflow.generics import logbook
from taskflow.generics import taskdetail
from taskflow.persistence.backends.memory import memory
from taskflow.persistence import flowdetail
from taskflow.persistence import logbook
from taskflow.persistence import taskdetail
from taskflow.utils import LockingDict
LOG = logging.getLogger(__name__)

View File

@@ -18,13 +18,13 @@
import contextlib
from taskflow.generics import flow
from taskflow.generics import flowdetail
from taskflow.generics import job
from taskflow.generics import jobboard
from taskflow.generics import logbook
from taskflow.generics import task
from taskflow.generics import taskdetail
from taskflow import flow
from taskflow.jobs import job
from taskflow.jobs import jobboard
from taskflow.persistence import flowdetail
from taskflow.persistence import logbook
from taskflow.persistence import taskdetail
from taskflow import task
from taskflow import utils

View File

@@ -22,12 +22,12 @@
import logging
from sqlalchemy import exc
from taskflow.backends.sqlalchemy import models
from taskflow.backends.sqlalchemy import session as sql_session
from taskflow import exceptions as exception
from taskflow.generics import flowdetail
from taskflow.generics import logbook
from taskflow.generics import taskdetail
from taskflow.persistence.backends.sqlalchemy import models
from taskflow.persistence.backends.sqlalchemy import session as sql_session
from taskflow.persistence import flowdetail
from taskflow.persistence import logbook
from taskflow.persistence import taskdetail
LOG = logging.getLogger(__name__)

View File

@@ -29,10 +29,10 @@ from sqlalchemy.orm import object_mapper, relationship
from sqlalchemy import DateTime, ForeignKey
from sqlalchemy import types as types
from taskflow.backends.sqlalchemy import session as sql_session
from taskflow import exceptions as exception
from taskflow.openstack.common import timeutils
from taskflow.openstack.common import uuidutils
from taskflow.persistence.backends.sqlalchemy import session as sql_session
CONF = cfg.CONF
BASE = declarative_base()

View File

@@ -29,7 +29,7 @@ from sqlalchemy.pool import NullPool
from sqlalchemy import exc
from taskflow.backends import api as b_api
from taskflow.persistence.backends import api as b_api
LOG = logging.getLogger(__name__)

View File

@@ -18,8 +18,8 @@
from datetime import datetime
from taskflow.backends import api as b_api
from taskflow.openstack.common import uuidutils
from taskflow.persistence.backends import api as b_api
class FlowDetail(object):

View File

@@ -18,8 +18,8 @@
from datetime import datetime
from taskflow.backends import api as b_api
from taskflow.openstack.common import uuidutils
from taskflow.persistence.backends import api as b_api
class LogBook(object):

View File

@@ -18,8 +18,8 @@
from datetime import datetime
from taskflow.backends import api as b_api
from taskflow.openstack.common import uuidutils
from taskflow.persistence.backends import api as b_api
class TaskDetail(object):

View File

@@ -17,7 +17,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from taskflow.backends import api as b_api
from taskflow.persistence.backends import api as b_api
def setUpModule():

View File

@@ -19,11 +19,11 @@
"""Import required libraries"""
import unittest2
from taskflow.backends import api as b_api
from taskflow import exceptions as exception
from taskflow.generics import flowdetail
from taskflow.openstack.common import uuidutils
from taskflow.patterns import graph_flow as flow
from taskflow.persistence.backends import api as b_api
from taskflow.persistence import flowdetail
from taskflow.tests import utils

View File

@@ -19,11 +19,11 @@
"""Import required libraries"""
import unittest2
from taskflow.backends import api as b_api
from taskflow import exceptions as exception
from taskflow.generics import logbook
from taskflow.openstack.common import uuidutils
from taskflow.patterns import graph_flow as flow
from taskflow.persistence.backends import api as b_api
from taskflow.persistence import logbook
from taskflow.tests import utils

View File

@@ -19,10 +19,10 @@
"""Import required libraries"""
import unittest2
from taskflow.backends import api as b_api
from taskflow import exceptions as exception
from taskflow.generics import taskdetail
from taskflow.openstack.common import uuidutils
from taskflow.persistence.backends import api as b_api
from taskflow.persistence import taskdetail
from taskflow.tests import utils

View File

@@ -20,8 +20,8 @@
import os
from os import path
from taskflow.backends import api as b_api
from taskflow.backends.sqlalchemy import models
from taskflow.persistence.backends import api as b_api
from taskflow.persistence.backends.sqlalchemy import models
def setUpModule():

View File

@@ -19,11 +19,11 @@
"""Import required libraries"""
import unittest2
from taskflow.backends import api as b_api
from taskflow import exceptions as exception
from taskflow.generics import flowdetail
from taskflow.openstack.common import uuidutils
from taskflow.patterns import graph_flow as flow
from taskflow.persistence.backends import api as b_api
from taskflow.persistence import flowdetail
from taskflow.tests import utils

View File

@@ -19,11 +19,11 @@
"""Import required libraries"""
import unittest2
from taskflow.backends import api as b_api
from taskflow import exceptions as exception
from taskflow.generics import logbook
from taskflow.openstack.common import uuidutils
from taskflow.patterns import graph_flow as flow
from taskflow.persistence.backends import api as b_api
from taskflow.persistence import logbook
from taskflow.tests import utils

View File

@@ -19,10 +19,10 @@
"""Import required libraries"""
import unittest2
from taskflow.backends import api as b_api
from taskflow import exceptions as exception
from taskflow.generics import taskdetail
from taskflow.openstack.common import uuidutils
from taskflow.persistence.backends import api as b_api
from taskflow.persistence import taskdetail
from taskflow.tests import utils

View File

@@ -22,9 +22,9 @@ from taskflow import decorators
from taskflow import exceptions as exc
from taskflow import states
from taskflow.backends import memory
from taskflow.patterns import linear_flow as lw
from taskflow.patterns.resumption import logbook as lr
from taskflow.persistence.backends import memory
from taskflow.tests import utils

View File

@@ -16,7 +16,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from taskflow.generics import task
from taskflow import task
ARGS_KEY = '__args__'
KWARGS_KEY = '__kwargs__'

View File

@@ -3,8 +3,7 @@ oslo.config>=1.1.0
iso8601
# Very nice graph library
networkx>=1.5
# Only needed if celery/distributed flows used.
celery
six
# Only needed if database backend used.
sqlalchemy>=0.7,<=0.7.99
sqlalchemy-migrate>=0.7