def compile(job, project, create_task):
        job_settings = json.loads(job.settings)
        task_type = 'blender_simple_render'
        parser = 'blender_render'

        task_settings = {}
        task_settings['filepath'] = job_settings['filepath']
        task_settings['priority'] = job.priority
        task_settings['render_settings'] = job_settings['render_settings']
        task_settings['format'] = job_settings['format']
        task_settings['command_name'] = job_settings['command_name']

        task_settings['file_path_linux'] = ""
        task_settings['file_path_win'] = ""
        task_settings['file_path_osx'] = ""

        task_settings['output_path_linux'] = '#####'
        task_settings['output_path_win'] = '#####'
        task_settings['output_path_osx'] = '#####'


        parsed_frames = frame_range_parse(job_settings['frames'])
        chunk_size = job_settings['chunk_size']

        for i in xrange(0, len(parsed_frames), chunk_size):
            task_settings['frames'] = frame_range_merge(parsed_frames[i:i + chunk_size])
            name = task_settings['frames']
            create_task(job.id, task_type, task_settings, name, None, parser)
    def compile(job, project, create_task):
        job_settings = json.loads(job.settings)
        task_type = 'blender_simple_render'
        parser = 'blender_render'

        task_settings = {}
        task_settings['filepath'] = job_settings['filepath']
        task_settings['priority'] = job.priority
        task_settings['render_settings'] = job_settings['render_settings']
        task_settings['format'] = job_settings['format']
        task_settings['command_name'] = job_settings['command_name']

        task_settings['file_path_linux'] = ""
        task_settings['file_path_win'] = ""
        task_settings['file_path_osx'] = ""

        task_settings['output_path_linux'] = '#####'
        task_settings['output_path_win'] = '#####'
        task_settings['output_path_osx'] = '#####'

        parsed_frames = frame_range_parse(job_settings['frames'])
        chunk_size = job_settings['chunk_size']

        for i in xrange(0, len(parsed_frames), chunk_size):
            task_settings['frames'] = frame_range_merge(
                parsed_frames[i:i + chunk_size])
            name = task_settings['frames']
            create_task(job.id, task_type, task_settings, name, None, parser)
Beispiel #3
0
    def frames_update_statuses(task, frames, status):
        """Update frame statuses

        :param task: the task object
        :param frames: the frame interval
        :type frame: string
        :param status: the status of the frames
        :type frame: string

        """

        settings = json.loads(task.settings)
        # Expand frame ranges into lists
        frame_statuses = {
            'frames_completed':
            frame_range_parse(settings.get('frames_completed')),
            'frames_waiting':
            frame_range_parse(settings.get('frames_waiting')),
            'frames_failed': frame_range_parse(settings.get('frames_failed')),
            'frames_active': frame_range_parse(settings.get('frames_active'))
        }

        frames = frame_range_parse(frames)

        # Generate the proper index depending on the frames we are updating
        if status == 'completed':
            index = 'frames_completed'

        frame_statuses[index].extend(frames)
        # Remove duplicate frames
        frames_changed = list(set(frame_statuses[index]))
        settings[index] = frame_range_merge(frames_changed)

        # Loop through the other frame_statuses and remove the frames we just updated
        for k, v in frame_statuses.items():
            if k != index:
                frames_shuffled = list(set(v) - set(frames_changed))
                settings[k] = frame_range_merge(frames_shuffled)

        # Push changes to database
        task.settings = json.dumps(settings)
        db.session.commit()
Beispiel #4
0
    def frames_update_statuses(task, frames, status):
        """Update frame statuses

        :param task: the task object
        :param frames: the frame interval
        :type frame: string
        :param status: the status of the frames
        :type frame: string

        """

        settings = json.loads(task.settings)
        # Expand frame ranges into lists
        frame_statuses = {
            'frames_completed': frame_range_parse(settings.get('frames_completed')),
            'frames_waiting': frame_range_parse(settings.get('frames_waiting')),
            'frames_failed': frame_range_parse(settings.get('frames_failed')),
            'frames_active': frame_range_parse(settings.get('frames_active'))
        }

        frames = frame_range_parse(frames)

        # Generate the proper index depending on the frames we are updating
        if status == 'completed':
            index = 'frames_completed'

        frame_statuses[index].extend(frames)
        # Remove duplicate frames
        frames_changed = list(set(frame_statuses[index]))
        settings[index] = frame_range_merge(frames_changed)

        # Loop through the other frame_statuses and remove the frames we just updated
        for k, v in frame_statuses.items():
            if k != index:
                frames_shuffled = list(set(v) - set(frames_changed))
                settings[k] = frame_range_merge(frames_shuffled)

        # Push changes to database
        task.settings = json.dumps(settings)
        db.session.commit()