Skip to content

Commit

Permalink
Add method addRenderPartition to api wrappers. (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoTavares committed Jun 3, 2020
1 parent fd03683 commit 30ca1f7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pycue/opencue/wrappers/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import enum
import time
import os

from opencue import Cuebot
from opencue.compiled_proto import job_pb2
Expand Down Expand Up @@ -72,6 +73,28 @@ def retry(self):
if self.data.state != job_pb2.FrameState.Value('WAITING'):
self.stub.Retry(job_pb2.FrameRetryRequest(frame=self.data), timeout=Cuebot.Timeout)

def addRenderPartition(self, hostname, threads, max_cores, num_mem, max_gpu):
"""Add a render partition to the frame.
@type hostname: str
@param hostname: hostname of the partition
@type threads: int
@param threads: number of threads of the partition
@type max_cores: int
@param max_cores: max cores enabled for the partition
@type num_mem: int
@param num_mem: amount of memory reserved for the partition
@type max_gpu: int
@param max_gpu: max gpu cores enabled for the partition
"""
response = self.stub.AddRenderPartition(
job_pb2.FrameAddRenderPartitionRequest(frame=self.data,
host=hostname,
threads=threads,
max_cores=max_cores,
max_memory=num_mem,
max_gpu=max_gpu,
username=os.getenv("USER", "unknown")))

def getWhatDependsOnThis(self):
"""Returns a list of dependencies that depend directly on this frame.
Expand Down
22 changes: 22 additions & 0 deletions pycue/opencue/wrappers/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,28 @@ def setAutoEating(self, value):
self.stub.SetAutoEat(job_pb2.JobSetAutoEatRequest(job=self.data, value=value),
timeout=Cuebot.Timeout)

def addRenderPartition(self, hostname, threads, max_cores, num_mem, max_gpu):
"""Add a render partition to the job.
@type hostname: str
@param hostname: hostname of the partition
@type threads: int
@param threads: number of threads of the partition
@type max_cores: int
@param max_cores: max cores enabled for the partition
@type num_mem: int
@param num_mem: amount of memory reserved for the partition
@type max_gpu: int
@param max_gpu: max gpu cores enabled for the partition
"""
self.stub.AddRenderPartition(
job_pb2.JobAddRenderPartRequest(job=self.data,
host=hostname,
threads=threads,
max_cores=max_cores,
max_memory=num_mem,
max_gpu=max_gpu,
username=os.getenv("USER", "unknown")))

def getWhatDependsOnThis(self):
"""Returns a list of dependencies that depend directly on this job.
Expand Down
23 changes: 23 additions & 0 deletions pycue/opencue/wrappers/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""

import enum
import os

from opencue.compiled_proto import job_pb2
from opencue.cuebot import Cuebot
Expand Down Expand Up @@ -161,6 +162,28 @@ def setThreadable(self, threadable):
layer=self.data, threadable=threadable),
timeout=Cuebot.Timeout)

def addRenderPartition(self, hostname, threads, max_cores, num_mem, max_gpu):
"""Add a render partition to the layer.
@type hostname: str
@param hostname: hostname of the partition
@type threads: int
@param threads: number of threads of the partition
@type max_cores: int
@param max_cores: max cores enabled for the partition
@type num_mem: int
@param num_mem: amount of memory reserved for the partition
@type max_gpu: int
@param max_gpu: max gpu cores enabled for the partition
"""
self.stub.AddRenderPartition(
job_pb2.LayerAddRenderPartitionRequest(layer=self.data,
host=hostname,
threads=threads,
max_cores=max_cores,
max_memory=num_mem,
max_gpu=max_gpu,
username=os.getenv("USER", "unknown")))

def getWhatDependsOnThis(self):
"""Gets a list of dependencies that depend directly on this layer.
Expand Down

0 comments on commit 30ca1f7

Please sign in to comment.