Cleaning up files/extraneous files/fixing relations

This commit is contained in:
Jessica Lucci
2013-05-22 15:40:00 -05:00
parent ad3b863150
commit 343f565f88
9 changed files with 15 additions and 29 deletions

View File

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

View File

@@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
# 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.
from taskflow.openstack.common import *

View File

@@ -24,7 +24,6 @@ from oslo.config import cfg
from taskflow.common import config from taskflow.common import config
from taskflow import utils from taskflow import utils
SQL_CONNECTION = 'sqlite://'
db_opts = [ db_opts = [
cfg.StrOpt('db_backend', cfg.StrOpt('db_backend',
default='sqlalchemy', default='sqlalchemy',
@@ -84,6 +83,9 @@ def job_get_owner(context, job_id):
def job_get_state(context, job_id): def job_get_state(context, job_id):
return IMPL.job_get_state(context, job_id) return IMPL.job_get_state(context, job_id)
def job_get_logbook(context, job_id):
return IMPL.job_get_logbook(context, job_id)
def job_destroy(context, job_id): def job_destroy(context, job_id):
return IMPL.job_destroy(context, job_id) return IMPL.job_destroy(context, job_id)

View File

@@ -136,6 +136,11 @@ def job_get_state(context, job_id):
job = job_get(context, job_id) job = job_get(context, job_id)
return job.state return job.state
def job_get_logbook(context, job_id):
"""Return the logbook associated with the given job"""
job = job_get(context, job_id)
return job.logbook
def job_destroy(context, job_id): def job_destroy(context, job_id):
"""Delete a given Job""" """Delete a given Job"""
session = get_session() session = get_session()

View File

@@ -48,7 +48,7 @@ class Json(types.TypeDecorator, types.MutableType):
class TaskFlowBase(object): class TaskFlowBase(object):
"""Base class for Heat Models.""" """Base class for TaskFlow Models."""
__table_args__ = {'mysql_engine':'InnoDB'} __table_args__ = {'mysql_engine':'InnoDB'}
__table_initialized = False __table_initialized = False
created_at = Column(DateTime, default=timeutils.utcnow) created_at = Column(DateTime, default=timeutils.utcnow)
@@ -132,6 +132,7 @@ class LogBook(BASE, TaskFlowBase):
name = Column(String) name = Column(String)
workflows = relationship("Workflow", workflows = relationship("Workflow",
secondary=workflow_logbook_assoc) secondary=workflow_logbook_assoc)
job = relationship("Job", uselist=False, backref="logbook")
class Job(BASE, TaskFlowBase): class Job(BASE, TaskFlowBase):
"""Represents a Job""" """Represents a Job"""
@@ -146,10 +147,11 @@ class Job(BASE, TaskFlowBase):
state = Column(String) state = Column(String)
workflows = relationship("Workflow", workflows = relationship("Workflow",
secondary=workflow_job_assoc) secondary=workflow_job_assoc)
logbook_id = Column(String, ForeignKey('logbook.logbook_id')
class Workflow(BASE, TaskFlowBase): class Workflow(BASE, TaskFlowBase):
"""Represents Workflow Objects""" """Represents Workflow detail objects"""
__tablename__ = 'workflow' __tablename__ = 'workflow'
@@ -158,7 +160,7 @@ class Workflow(BASE, TaskFlowBase):
tasks = relationship("Task", backref="workflow") tasks = relationship("Task", backref="workflow")
class Task(BASE, TaskFlowBase): class Task(BASE, TaskFlowBase):
"""Represents Task Objects""" """Represents Task detail objects"""
__tablename__ = 'task' __tablename__ = 'task'

View File

@@ -26,7 +26,7 @@ from celery import chord
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class Workflow(object): class Flow(object):
"""A linear chain of independent tasks that can be applied as one unit or """A linear chain of independent tasks that can be applied as one unit or
rolled back as one unit.""" rolled back as one unit."""
@@ -83,5 +83,5 @@ class Workflow(object):
def run(self, context, *args, **kwargs): def run(self, context, *args, **kwargs):
""" Start root task and kick off workflow """ """ Start root task and kick off workflow """
root(context) self.root(context)
LOG.info('WF %s has been started' % (self.name,)) LOG.info('WF %s has been started' % (self.name,))