Created
October 27, 2014 23:05
-
-
Save ourway/97c6fd88fee82e319a7f to your computer and use it in GitHub Desktop.
Stalker_test_error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!st_test_env/bin/python | |
from stalker import db | |
db.setup() | |
db.init() | |
import datetime | |
from stalker import Studio | |
my_studio = Studio( | |
name='My Great Studio' | |
) | |
from stalker import User | |
me = User( | |
name="Erkan Ozgur Yilmaz", | |
login="eoyilmaz", | |
email="some_email_address@gmail.com", | |
password="secret", | |
description="This is me" | |
) | |
from stalker import Department | |
tds_department = Department( | |
name="TDs", | |
description="This is the TDs department" | |
) | |
tds_department.users.append(me) | |
db.DBSession.add(my_studio) | |
db.DBSession.add(me) | |
db.DBSession.add(tds_department) | |
db.DBSession.commit() | |
from stalker import Status | |
status_new = Status.query.filter_by(code='NEW').first() | |
status_wip = Status.query.filter_by(code='WIP').first() | |
status_cmpl = Status.query.filter_by(code='CMPL').first() | |
from stalker import StatusList, Project | |
project_statuses = StatusList( | |
name="Project Status List", | |
statuses=[ | |
status_new, | |
status_wip, | |
status_cmpl | |
], | |
target_entity_type=Project # you can also use "Project" which is a str | |
) | |
from stalker import Repository | |
# and the repository itself | |
commercial_repo = Repository( | |
name="Commercial Repository" | |
) | |
new_project = Project( | |
name="Fancy Commercial", | |
code='FC', | |
status_list=project_statuses, | |
repository=commercial_repo, | |
) | |
import datetime | |
from stalker import ImageFormat | |
new_project.description = \ | |
"""The commercial is about this fancy product. The | |
client want us to have a shiny look with their | |
product bla bla bla...""" | |
new_project.image_format = ImageFormat( | |
name="HD 1080", | |
width=1920, | |
height=1080 | |
) | |
new_project.fps = 25 | |
new_project.end = datetime.date(2014, 5, 15) | |
new_project.lead = me | |
db.DBSession.add(new_project) | |
db.DBSession.commit() | |
from stalker import Sequence | |
seq1 = Sequence( | |
name="Sequence 1", | |
code="SEQ1", | |
project=new_project, | |
) | |
from stalker import Shot | |
sh001 = Shot( | |
name='SH001', | |
code='SH001', | |
project=new_project, | |
sequences=[seq1] | |
) | |
sh002 = Shot( | |
code='SH002', | |
project=new_project, | |
sequences=[seq1] | |
) | |
sh003 = Shot( | |
code='SH003', | |
project=new_project, | |
sequences=[seq1] | |
) | |
db.DBSession.add_all([sh001, sh002, sh003]) | |
db.DBSession.commit() | |
sh004 = Shot( | |
code='SH004', | |
project=new_project, | |
sequences=[seq1] | |
) | |
db.DBSession.add(sh004) | |
db.DBSession.commit() | |
from stalker import Task | |
previs = Task( | |
name="Previs", | |
parent=sh001 | |
) | |
matchmove = Task( | |
name="Matchmove", | |
parent=sh001 | |
) | |
anim = Task( | |
name="Animation", | |
parent=sh001 | |
) | |
lighting = Task( | |
name="Lighting", | |
parent=sh001 | |
) | |
comp = Task( | |
name="comp", | |
parent=sh001 | |
) | |
db.DBSession.add_all([previs, matchmove, anim, lighting, comp]) | |
db.DBSession.commit() | |
comp.depends = [lighting] | |
lighting.depends = [anim] | |
anim.depends = [previs, matchmove] | |
previs.resources = [me] | |
previs.schedule_timing = 10 | |
previs.schedule_unit = 'd' | |
matchmove.resources = [me] | |
matchmove.schedule_timing = 2 | |
matchmove.schedule_unit = 'd' | |
anim.resources = [me] | |
anim.schedule_timing = 5 | |
anim.schedule_unit = 'd' | |
lighting.resources = [me] | |
lighting.schedule_timing = 3 | |
lighting.schedule_unit = 'd' | |
comp.resources = [me] | |
comp.schedule_timing = 6 | |
comp.schedule_unit = 'd' | |
db.DBSession.commit() | |
from stalker import TaskJugglerScheduler | |
#my_studio.scheduler = TaskJugglerScheduler() | |
db.DBSession.commit() | |
#my_studio.schedule(scheduled_by=me) | |
print my_studio.start | |
print my_studio.end |
Ok the problem is related with the "my_studio.end" is not set properly prior to scheduling. So for the last part of your code add these
my_studio.scheduler = TaskJugglerScheduler()
my_studio.end = my_studio.start + datetime.timedelta(days=365) # just to be sure
my_studio.schedule(scheduled_by=me)
db.DBSession.commit()
Now it will properly schedule the projects.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems my_studio.end is a wrong date.