Support for the bundle command

This is primarily meant to be used via 3rd party applications (like the
Blender Cloud). The external software requires a bundle, and if was
already build it gets served a local filesystem path, that can be
further used. Otherwise the bundle is built.
This commit is contained in:
2015-01-12 18:15:54 +01:00
parent 1379f375ee
commit 0f80f31ac4
6 changed files with 136 additions and 21 deletions

View File

@@ -0,0 +1,28 @@
import datetime
from application import db
class Bundle(db.Model):
"""Bundles are the results of a 'bam bundle' command. When running such command
for the first time we:
- create a task in the queue (see the queue module)
- create a bundle entry and set its status as 'waiting'
- executed the task (at due time)
- set the bundle entry status to 'building'
- once completed we set the status to 'available'
- serve the bundle_path
The bundle_path can be used but an application that shares access to the BAM
storage, as well as by the 'bam checkout' command itself (later on).
If this is not the case, we will provide a working download link via the 'bam info'.
"""
id = db.Column(db.Integer, primary_key=True)
source_file_path = db.Column(db.String(512), nullable=False)
bundle_path = db.Column(db.String(512))
status = db.Column(db.String(80))
creation_date = db.Column(db.DateTime(), default=datetime.datetime.now)
update_date = db.Column(db.DateTime(), default=datetime.datetime.now)
def __str__(self):
return str(self.name)