コード例 #1
0
ファイル: orm.py プロジェクト: eBayClassifiedsGroup/orlo
 def to_dict(self):
     time_format = config.get('main', 'time_format')
     return {
         'id': str(self.id),
         'name': self.name,
         'version': self.version,
         'stime': self.stime.strftime(config.get('main', 'time_format')) if self.stime else None,
         'ftime': self.ftime.strftime(config.get('main', 'time_format')) if self.ftime else None,
         'duration': self.duration.seconds if self.duration else None,
         'rollback': self.rollback,
         'status': self.status,
         'diff_url': self.diff_url,
     }
コード例 #2
0
ファイル: orm.py プロジェクト: eBayClassifiedsGroup/orlo
 def stop(self):
     """
     Mark a release as stopped
     """
     self.ftime = arrow.now(config.get('main', 'time_zone'))
     td = self.ftime - self.stime
     self.duration = td
コード例 #3
0
ファイル: cli.py プロジェクト: eBayClassifiedsGroup/orlo
def setup_database(args):
    from orlo.orm import db
    from orlo.config import config

    if config.get('db', 'uri') == 'sqlite://':
        print("Warning: setting up in-memory database, this is "
              "probably not what you want!\n"
              "Please configure db:uri in /etc/orlo/orlo.ini")
    db.create_all()
コード例 #4
0
ファイル: orm.py プロジェクト: eBayClassifiedsGroup/orlo
    def to_dict(self):
        time_format = config.get('main', 'time_format')

        metadata = {}
        for m in self.metadata:
            metadata.update(m.to_dict())

        return {
            'id': str(self.id),
            'packages': [p.to_dict() for p in self.packages],
            'platforms': [platform.name for platform in self.platforms],
            'references': string_to_list(self.references),
            'stime': self.stime.strftime(config.get('main', 'time_format')) if self.stime else None,
            'ftime': self.ftime.strftime(config.get('main', 'time_format')) if self.ftime else None,
            'duration': self.duration.seconds if self.duration else None,
            'metadata': metadata,
            'user': self.user,
            'team': self.team,
        }
コード例 #5
0
ファイル: orm.py プロジェクト: dustinnguyen/orlo
    def stop(self, success):
        """
        Mark a package deployment as stopped

        :param success: Whether or not the package deploy succeeded
        """
        if self.stime is None:
            raise OrloWorkflowError("Can not stop a package which has not been started")
        self.ftime = arrow.now(config.get('main', 'time_zone'))

        td = self.ftime - self.stime
        self.duration = td

        if success:
            self.status = 'SUCCESSFUL'
        else:
            self.status = 'FAILED'
コード例 #6
0
ファイル: orm.py プロジェクト: eBayClassifiedsGroup/orlo
 def start(self):
     """
     Mark a package deployment as started
     """
     self.stime = arrow.now(config.get('main', 'time_zone'))
     self.status = 'IN_PROGRESS'
コード例 #7
0
ファイル: orm.py プロジェクト: eBayClassifiedsGroup/orlo
 def start(self):
     """
     Mark a release as started
     """
     self.stime = arrow.now(config.get('main', 'time_zone'))
コード例 #8
0
ファイル: orm.py プロジェクト: eBayClassifiedsGroup/orlo
from sqlalchemy_utils.types.uuid import UUIDType
from sqlalchemy_utils.types.arrow import ArrowType

from orlo import app, config
from orlo.exceptions import OrloWorkflowError
import pytz
import uuid
import arrow
import json

__author__ = 'alforbes'

db = SQLAlchemy(app)

try:
    TIMEZONE = pytz.timezone(config.get('main', 'time_zone'))
except pytz.exceptions.UnknownTimeZoneError:
    app.logger.critical(
        'Unknown time zone "{}", see pytz docs for valid values'.format(
            config.get('main', 'timezone')
        ))


# Map releases to platforms
release_platform = db.Table(
    'release_platform', db.Model.metadata,
    db.Column('release_id', UUIDType, db.ForeignKey('release.id')),
    db.Column('platform_id', UUIDType, db.ForeignKey('platform.id'))
)