Skip to content
Snippets Groups Projects
Commit f36ec524 authored by Francesco Siddi's avatar Francesco Siddi
Browse files

Server: removed some project settings

The Project model was featuring some unused parameters, such as
path_linux or render_path_linux. On the server we have only one storage
entry point (per project automations can be set up later), and that
storage hold I/O files for each job. Shared paths can be set up at the
manager level.
parent 05425bb0
No related branches found
No related tags found
No related merge requests found
import os import os
import json import json
#import logging
#from application import app
class task_compiler(): class task_compiler():
@staticmethod @staticmethod
def compile(worker, task, add_file): def compile(worker, task, add_file):
settings=task['settings'] settings=task['settings']
"""if 'Darwin' in worker.system:
setting_blender_path = app.config['BLENDER_PATH_OSX']
setting_render_settings = app.config['SETTINGS_PATH_OSX']
file_path = settings['file_path_osx']
output_path = settings['output_path_osx']
elif 'Windows' in worker.system:
setting_blender_path = app.config['BLENDER_PATH_WIN']
setting_render_settings = app.config['SETTINGS_PATH_WIN']
file_path = settings['file_path_win']
output_path = settings['output_path_win']
elif 'Linux' in worker.system:
setting_blender_path = app.config['BLENDER_PATH_LINUX']
setting_render_settings = app.config['SETTINGS_PATH_LINUX']
file_path = settings['file_path_linux']
output_path = settings['output_path_linux']
if setting_blender_path is None:
logging.info('[Debug] blender path is not set')
return None
if setting_render_settings is None:
logging.warning("Render settings path not set!")
return None
setting_render_settings = app.config['SETTINGS_PATH_LINUX']
render_settings = os.path.join(
setting_render_settings,
settings['render_settings'])"""
# TODO
#file_path = os.path.split(settings['file_path_linux'])[1]
file_path = os.path.join('==jobpath==', settings['filepath']) file_path = os.path.join('==jobpath==', settings['filepath'])
output_path = "==outputpath==" output_path = "==outputpath=="
...@@ -52,14 +17,12 @@ class task_compiler(): ...@@ -52,14 +17,12 @@ class task_compiler():
script = f.read() script = f.read()
f.close() f.close()
add_file( add_file(
script, script,
'pre_render.py', 'pre_render.py',
task['job_id'] task['job_id']
) )
script_path = os.path.join( script_path = os.path.join(
"==jobpath==", "pre_render.py") "==jobpath==", "pre_render.py")
......
...@@ -14,20 +14,9 @@ class job_compiler(): ...@@ -14,20 +14,9 @@ class job_compiler():
task_settings['render_settings'] = job_settings['render_settings'] task_settings['render_settings'] = job_settings['render_settings']
task_settings['format'] = job_settings['format'] task_settings['format'] = job_settings['format']
task_settings['command_name'] = job_settings['command_name'] task_settings['command_name'] = job_settings['command_name']
#project = Project.query.filter_by(id = job.project_id).first()
#filepath = task_settings['filepath']
"""task_settings['file_path_linux'] = os.path.join(project.path_linux, filepath)
task_settings['file_path_win'] = os.path.join(project.path_win, filepath)
task_settings['file_path_osx'] = os.path.join(project.path_osx, filepath)"""
task_settings['file_path_linux'] = "" task_settings['file_path_linux'] = ""
task_settings['file_path_win'] = "" task_settings['file_path_win'] = ""
task_settings['file_path_osx'] = "" task_settings['file_path_osx'] = ""
#task_settings['settings'] = task.settings
"""task_settings['output_path_linux'] = os.path.join(project.render_path_linux, str(job.id), '#####')
task_settings['output_path_win'] = os.path.join(project.render_path_win, str(job.id), '#####')
task_settings['output_path_osx'] = os.path.join(project.render_path_osx, str(job.id), '#####')"""
task_settings['output_path_linux'] = '#####' task_settings['output_path_linux'] = '#####'
task_settings['output_path_win'] = '#####' task_settings['output_path_win'] = '#####'
task_settings['output_path_osx'] = '#####' task_settings['output_path_osx'] = '#####'
......
...@@ -6,27 +6,16 @@ class job_compiler(): ...@@ -6,27 +6,16 @@ class job_compiler():
@staticmethod @staticmethod
def compile(job, project, create_task): def compile(job, project, create_task):
parser = 'blender_render' parser = 'blender_render'
job_settings = json.loads(job.settings) job_settings = json.loads(job.settings)
task_settings={} task_settings = dict(
task_settings['filepath'] = job_settings['filepath'] filepath=job_settings['filepath'],
task_settings['render_settings'] = job_settings['render_settings'] render_settings=job_settings['render_settings'],
task_settings['format'] = job_settings['format'] format=job_settings['format'],
task_settings['command_name'] = job_settings['command_name'] command_name=job_settings['command_name'],
priority=job.priority,
#project = Project.query.filter_by(id = job.project_id).first() frame_start=job_settings['frames'].split('-')[0],
filepath = task_settings['filepath'] frame_end=job_settings['frames'].split('-')[0]
task_settings['file_path_linux'] = os.path.join(project.path_linux, filepath) )
task_settings['file_path_win'] = os.path.join(project.path_win, filepath)
task_settings['file_path_osx'] = os.path.join(project.path_osx, filepath)
#task_settings['settings'] = task.settings
task_settings['output_path_linux'] = os.path.join(project.render_path_linux, str(job.id))
task_settings['output_path_win'] = os.path.join(project.render_path_win, str(job.id))
task_settings['output_path_osx'] = os.path.join(project.render_path_osx, str(job.id))
task_settings['priority'] = job.priority
task_settings['frame_start']=job_settings['frames'].split('-')[0]
task_settings['frame_end']=job_settings['frames'].split('-')[0]
tiles = 4 tiles = 4
task_settings['tiles'] = tiles task_settings['tiles'] = tiles
......
...@@ -12,28 +12,12 @@ from application.modules.jobs.model import Job ...@@ -12,28 +12,12 @@ from application.modules.jobs.model import Job
parser = reqparse.RequestParser() parser = reqparse.RequestParser()
parser.add_argument('name', type=str) parser.add_argument('name', type=str)
parser.add_argument('path_server', type=str)
parser.add_argument('path_linux', type=str)
parser.add_argument('path_win', type=str)
parser.add_argument('path_osx', type=str)
parser.add_argument('render_path_server', type=str)
parser.add_argument('render_path_linux', type=str)
parser.add_argument('render_path_win', type=str)
parser.add_argument('render_path_osx', type=str)
parser.add_argument('is_active', type=bool) parser.add_argument('is_active', type=bool)
project_fields = { project_fields = {
'id' : fields.Integer, 'id' : fields.Integer,
'name' : fields.String, 'name' : fields.String,
'path_server' : fields.String,
'path_linux' : fields.String,
'path_win' : fields.String,
'path_osx' : fields.String,
'render_path_server' : fields.String,
'render_path_linux' : fields.String,
'render_path_win' : fields.String,
'render_path_osx' : fields.String,
'is_active' :fields.Boolean 'is_active' :fields.Boolean
} }
...@@ -50,14 +34,6 @@ class ProjectListApi(Resource): ...@@ -50,14 +34,6 @@ class ProjectListApi(Resource):
for project in Project.query.all(): for project in Project.query.all():
projects[project.id] = dict( projects[project.id] = dict(
name=project.name) name=project.name)
"""path_server=project.path_server,
path_linux=project.path_linux,
path_win=project.path_win,
path_osx=project.path_osx,
render_path_server=project.render_path_server,
render_path_linux=project.render_path_linux,
render_path_win=project.render_path_win,
render_path_osx=project.render_path_osx)"""
return jsonify(projects) return jsonify(projects)
@marshal_with(project_fields) @marshal_with(project_fields)
...@@ -65,14 +41,6 @@ class ProjectListApi(Resource): ...@@ -65,14 +41,6 @@ class ProjectListApi(Resource):
args = parser.parse_args() args = parser.parse_args()
project = Project( project = Project(
name=args['name']) name=args['name'])
"""path_server=args['path_server'],
path_linux=args['path_linux'],
path_win=args['path_win'],
path_osx=args['path_osx'],
render_path_server=args['render_path_server'],
render_path_linux=args['render_path_linux'],
render_path_win=args['render_path_win'],
render_path_osx=args['render_path_osx'])"""
db.session.add(project) db.session.add(project)
db.session.commit() db.session.commit()
...@@ -116,14 +84,6 @@ class ProjectApi(Resource): ...@@ -116,14 +84,6 @@ class ProjectApi(Resource):
def put(self, project_id): def put(self, project_id):
args = parser.parse_args() args = parser.parse_args()
project = Project.query.get_or_404(project_id) project = Project.query.get_or_404(project_id)
project.path_server = args['path_server']
project.path_linux = args['path_linux']
project.path_win = args['path_win']
project.path_osx = args['path_osx']
project.render_path_server = args['render_path_server']
project.render_path_linux = args['render_path_linux']
project.render_path_win = args['render_path_win']
project.render_path_osx = args['render_path_osx']
if args['name']: if args['name']:
project.name = args['name'] project.name = args['name']
if args['is_active']: if args['is_active']:
......
from datetime import date import datetime
from application import db from application import db
from application.modules.settings.model import Setting from application.modules.settings.model import Setting
class Project(db.Model): class Project(db.Model):
"""Production project folders """The project model is used mostly for overview queries on jobs. Most of
the configuration values that were originally associated with a project
This is a temporary table to get quickly up and running with project have been moved to the managers.
support in flamenco. In the future, project definitions could come from
attract or it could be defined in another way.
""" """
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(120)) name = db.Column(db.String(120))
path_server = db.Column(db.Text()) status = db.Column(db.String(80))
path_linux = db.Column(db.Text()) creation_date = db.Column(db.DateTime(), default=datetime.datetime.now)
path_win = db.Column(db.Text())
path_osx = db.Column(db.Text())
render_path_server = db.Column(db.Text())
render_path_linux = db.Column(db.Text())
render_path_win = db.Column(db.Text())
render_path_osx = db.Column(db.Text())
@property @property
def is_active(self): def is_active(self):
......
"""Project table cleanup
Revision ID: 86dad093873
Revises: 2d4e61f9aa2a
Create Date: 2015-10-18 21:04:19.180507
"""
# revision identifiers, used by Alembic.
revision = '86dad093873'
down_revision = '2d4e61f9aa2a'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('project', sa.Column('creation_date', sa.DateTime(), nullable=True))
op.add_column('project', sa.Column('status', sa.String(length=80), nullable=True))
with op.batch_alter_table('project', schema=None) as batch_op:
batch_op.drop_column('path_linux')
batch_op.drop_column('render_path_linux')
batch_op.drop_column('render_path_osx')
batch_op.drop_column('path_win')
batch_op.drop_column('render_path_server')
batch_op.drop_column('render_path_win')
batch_op.drop_column('path_osx')
batch_op.drop_column('path_server')
def downgrade():
op.add_column('project', sa.Column('path_server', sa.TEXT(), nullable=True))
op.add_column('project', sa.Column('path_osx', sa.TEXT(), nullable=True))
op.add_column('project', sa.Column('render_path_win', sa.TEXT(), nullable=True))
op.add_column('project', sa.Column('render_path_server', sa.TEXT(), nullable=True))
op.add_column('project', sa.Column('path_win', sa.TEXT(), nullable=True))
op.add_column('project', sa.Column('render_path_osx', sa.TEXT(), nullable=True))
op.add_column('project', sa.Column('render_path_linux', sa.TEXT(), nullable=True))
op.add_column('project', sa.Column('path_linux', sa.TEXT(), nullable=True))
with op.batch_alter_table('project', schema=None) as batch_op:
batch_op.drop_column('status')
batch_op.drop_column('creation_date')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment