예제 #1
0
    def testShellScript(self):
        fp = open("test.sh", "w")
        fp.write("#!/bin/sh\n")
        fp.write("echo zoom zoom zoom")
        fp.close()

        ol = outline.Outline(name="shell_script_test_v1", current=True)
        ol.add_layer(ShellScript("script", script="test.sh"))
        cuerun.launch(ol, test=True)
예제 #2
0
def main(input_path, fps, crf, chunk, output_path):
    """
    Sends a job to opencue that will compress an image sequence to
    an H.264 file using multiple render nodes in parallel
    :input_path: str - path to the first frame of the image sequence
    :fps: float - framerate of the desired encoded file
    :crf: int - quality of the desired encoded file

    """
    input_path = os.path.abspath(input_path)
    shot_name = os.path.basename(input_path)
    job_name = "dpx_to_mov"
    show_name = "testing"
    user = getpass.getuser()
    outline = Outline(job_name, shot=shot_name, show=show_name, user=user)

    # Create the MakeMov Layer
    layer_name = "seq_to_mov"
    threads = 1.0
    threadable = False
    frame_start, frame_end = get_imgseq_framerange(input_path)
    range_len = int(frame_end) - int(frame_start)
    frame_range = frame_start + "-" + frame_end
    input_path_ffmpeg = translate_imgseq_ffmpeg(input_path)
    output_chunk_path_template = create_chunk_path_template(input_path)

    seqtomov_layer = SeqToMov(layer_name,
                              chunk=chunk,
                              threads=threads,
                              range=frame_range,
                              threadable=threadable,
                              crf=crf,
                              fps=fps)
    seqtomov_layer.add_input("main", input_path_ffmpeg)
    seqtomov_layer.add_output("main", output_chunk_path_template)

    outline.add_layer(seqtomov_layer)

    # Create the ConcatMov Layer
    layer_name = "concat_mov"
    concatmov_layer = ConcatMov(layer_name,
                                chunk=1,
                                threads=threads,
                                range=1,
                                threadable=threadable)
    chunk_paths = get_chunk_paths(output_chunk_path_template, chunk,
                                  frame_start, frame_end)
    for chunk_path in enumerate(chunk_paths):
        concatmov_layer.add_input("", chunk_path)
    concatmov_layer.add_output("main", output_path)
    concatmov_layer.depend_all(seqtomov_layer)

    outline.add_layer(concatmov_layer)

    # Submit job
    cuerun.launch(outline, use_pycuerun=False)
예제 #3
0
    def launch_outline(self, outline, **override):
        """
        Launches the specified outline script with the options parsed
        from the command line.
        """
        from outline import cuerun, config, event

        if self.__options.debug:

            bin_dir = os.path.dirname(os.path.abspath(__file__))
            logger.debug("Overriding cuerun bin directory to %s" % bin_dir)

            # Overide the location of the bin dir to the one where
            # this script is located if we're in debug mode.
            config.set("outline", "bin_dir", bin_dir)

        self.__evh.emit(
            event.LaunchEvent(event.BEFORE_LAUNCH, self, outline=outline))
        try:
            args = self.options_to_dict(self.__options)
            args.update(override)
            result = cuerun.launch(outline, **args)
            self.__evh.emit(
                event.LaunchEvent(event.AFTER_LAUNCH,
                                  self,
                                  job=result,
                                  outline=outline))
            return result
        except Exception, e:
            sys.stderr.write("outline failure, %s" % e)
            traceback.print_exc(file=sys.stderr)
            sys.exit(1)
예제 #4
0
def submitJob(jobData):
    """Submit the job using the PyOutline API."""
    outline = Outline(jobData['name'],
                      shot=jobData['shot'],
                      show=jobData['show'],
                      user=jobData['username'])
    lastLayer = None
    for layerData in jobData['layers']:
        if layerData.layerType == JobTypes.JobTypes.MAYA:
            layer = buildMayaLayer(layerData, lastLayer)
        elif layerData.layerType == JobTypes.JobTypes.SHELL:
            layer = buildShellLayer(layerData, lastLayer)
        elif layerData.layerType == JobTypes.JobTypes.NUKE:
            layer = buildNukeLayer(layerData, lastLayer)
        elif layerData.layerType == JobTypes.JobTypes.BLENDER:
            layer = buildBlenderLayer(layerData, lastLayer)
        else:
            raise ValueError('unrecognized layer type %s' %
                             layerData.layerType)
        outline.add_layer(layer)
        lastLayer = layer

    if 'facility' in jobData:
        outline.set_facility(jobData['facility'])

    return cuerun.launch(outline, use_pycuerun=False)
예제 #5
0
    def _doDispatch(self, rootBatch):

        # Construct an object to track everything we need
        # to generate the job. I have a suspicion that at
        # some point we'll want a Dispatcher::Job base class
        # which _doDispatch() must return, in which case this
        # might just be member data for a subclass of one of those.
        dispatchData = {}
        dispatchData["scriptNode"] = rootBatch.preTasks()[0].node().scriptNode(
        )
        dispatchData["scriptFile"] = Gaffer.Context.current(
        )["dispatcher:scriptFileName"]
        dispatchData["batchesToLayers"] = {}

        # Create an OpenCue outline and set its basic properties.

        context = Gaffer.Context.current()

        outline = Outline(
            context.substitute(self["jobName"].getValue()) or "untitled",
            show=context.substitute(self["showName"].getValue()) or "show",
            shot=context.substitute(self["shotName"].getValue()) or "shot",
            user=context.substitute(self["userName"].getValue()) or "user",
        )

        # Populate the job with tasks from the batch tree
        # that was prepared by our base class.

        for upstreamBatch in rootBatch.preTasks():
            self.__buildOutlineWalk(outline, upstreamBatch, dispatchData)

        # Signal anyone who might want to make just-in-time
        # modifications to the job.

        self.preSpoolSignal()(self, outline)

        # Finally, we can spool the job.

        cuerun.launch(outline, use_pycuerun=False)
예제 #6
0
def submitJob(jobData):
    """Submit the job using the PyOutline API."""
    outline = Outline(jobData['name'],
                      shot=jobData['shot'],
                      show=jobData['show'],
                      user=jobData['username'])
    for layerData in jobData['layers']:
        if layerData.layerType == JobTypes.JobTypes.MAYA:
            layer = buildMayaLayer(layerData)
        elif layerData.layerType == JobTypes.JobTypes.SHELL:
            layer = buildShellLayer(layerData)
        elif layerData.layerType == JobTypes.JobTypes.NUKE:
            layer = buildNukeLayer(layerData)
        outline.add_layer(layer)
    return cuerun.launch(outline, use_pycuerun=False)
예제 #7
0
    def testShellSequence(self):
        """Test a simple sequence of shell commands"""

        commands = ["/bin/ls"] * 10

        ol = outline.Outline(name="shell_sequence_test_v1", current=True)
        ol.add_layer(ShellSequence("bah", commands=commands, cores=10, memory="512m"))
        job = cuerun.launch(ol, pause=True)

        self.assertEquals(10, job.stats.waitingFrames)
        self.assertEquals(10, job.stats.pendingFrames)

        cue.test(job)

        job = opencue.getJob(job)
        self.assertEquals(0, job.stats.waitingFrames)
        self.assertEquals(10, job.stats.succeededFrames)
예제 #8
0
from outline import Outline, cuerun

# Create an outline for the job
job_name = "debug_job"
shot_name = "debug_shot"
show_name = "testing"
user = getpass.getuser()

outline = Outline(job_name, shot=shot_name, show=show_name, user=user)

# Create the debug Layer
layer_name = "debug_layer"
chunk_size = 1
threads = 1.0
threadable = False
frame_range = "1"

debug_layer = DebugLayer(layer_name,
                         input="input_path",
                         output="output_path",
                         chunk=chunk_size,
                         threads=threads,
                         range=frame_range,
                         threadable=threadable,
                         crf=25)

outline.add_layer(debug_layer)

# Submit job
cuerun.launch(outline, use_pycuerun=False)
# SUBMIT ############################################################
outline = Outline(jobData['name'],
                  shot=jobData['shot'],
                  show=jobData['show'],
                  user=jobData['username'])
layers = []
for layerData in jobData['layers']:
    layer = Shell(layerData.name,
                  command=layerData.cmd.split(),
                  chunk='1',
                  threads=float(layerData.cores),
                  range=str(layerData.layerRange),
                  threadable=True)
    layer.set_service(layerData.services[0])
    layers.append(layer)

layer_count = 0
for layer in layers:
    if layer_count > 0:
        layer.depend_all(layers[layer_count - 1])
    layer_count += 1
    outline.add_layer(layer)

jobs = cuerun.launch(outline, use_pycuerun=False, pause=True)
for job in jobs:
    print(job.name())
    job.setPriority(10)
    job.setMaxCores(1500)
    job.setMaxRetries(3)
예제 #10
0
#!/bin/env python2.5

#  Copyright (c) 2018 Sony Pictures Imageworks Inc.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.



from outline import Outline, cuerun
from outline.modules.tutorial import HelloModule

ol = Outline("my_job")
ol.add_layer(HelloModule("my_layer"))

cuerun.launch(ol, range="1-10", pause=True)
예제 #11
0
 def testShellToString(self):
     """Test a string shell command."""
     ol = outline.Outline(name="string_test_v1")
     ol.add_layer(Shell("string_test", command="/bin/ls -l ./"))
     cuerun.launch(ol, range="1", test=True)
예제 #12
0
    def testShell(self):
        """Test a simple shell command."""

        ol = outline.Outline(name="shell_test_v1")
        ol.add_layer(Shell("bah", command=["/bin/ls"]))
        cuerun.launch(ol, range="1", test=True)