def func2(): log.info('func 2') log.debug('raise in func 2') try: func_err() except Exception: log.error('ERROR IN FUNC 2', trace=True)
def custom(self): log.debug('STANDARD SDK', box='.') self.pre_std() log.debug('... import sdk') import cgev.vray.sdk as sdk self.bench(sdk) del sdk del sys.modules['cgev.vray.sdk']
def std(self): log.debug('STANDARD SDK', box='.') self.pre_std() log.debug('... import sdk') import vray # @UnresolvedImport self.bench(vray) del vray self.post_std()
def main_simple(num, path): log.debug('SIMPLE {0} instances', num) while num > 0: num -= 1 win = QtGui.QWidget() layout = QtGui.QVBoxLayout() label = QtGui.QLabel() layout.addWidget(label) icon = QtGui.QLabel() layout.addWidget(icon) win.setLayout(layout) log.debug('DONE')
def main_uic(num, path): sys.path.insert(0, os.path.dirname(path)) from test_widget import Ui_graphContainer container = Ui_graphContainer() log.debug('UIC {0} instances of {1}', num, path) while num > 0: num -= 1 win = QtGui.QWidget() container.setupUi(win) log.debug('DONE')
def main_sh(): cmd = 'sh.exe C:/work/T00N3Kit/test/misc/shell_script.sh plop 1' log.debug('call') print system.shell(cmd) log.debug('logged') print system.shell(cmd, mode=system.EXEC_MODE.LOGGED) log.debug('background') print system.shell(cmd, mode=system.EXEC_MODE.BACKGROUND) log.debug('DONE !')
def main(): log.debug('launch context test') log.debug(connectortools.getCurrentApp()) log.debug(connectortools.getAppVersion()) client = SessionClient() ''' log.debug('say hi') log.debug(client.hi()) log.debug('getting manager') response = client.getManager() obj = response.datas log.debug('got {} {}', obj, type(obj)) ''' ''' from cgev.pipeline.data import session from cgev.pipeline.process import start log.debug(session.getManager()) ''' session.setClient(client) projects = server.getProjects(None) print projects
def concatVRScene(self, context, renderer): log.debug('CONCAT {0}', context) inputs = ['shapes', 'shaders', 'lights', 'nodes', 'settings', 'others'] plugins = dict() fields = self._inHeap.get(context, dict()) context = None for field in inputs: values = [token.value for token in fields.get(field, list())] plugins[field] = values context = token.context scene = context.token.value vrs = VRScene() for field, plugs in plugins.iteritems(): vrs.add(plugs, renderer) base = os.path.basename(scene) path = 'C:/work/scenes/vray/export/{0}'.format(base) base = os.path.dirname(path) if not os.path.exists(base): os.makedirs(base) log.debug('EXPORT TO {0}', path) vrs.save(path) render = self.field('render').value if render: vrs.render(wait=3) if os.path.exists(path): log.debug('{0} DONE !') self.field('path').push(context, path) else: log.debug('FAILED !')
def __init__(self, meth, loops): super(Win, self).__init__() layout = QtGui.QVBoxLayout() self.setLayout(layout) root = QtGui.QWidget() root.setLayout(layout) self.setCentralWidget(root) log.debug('Starting {0} {1} creations ...', loops, meth) start = datetime.now() widgets = list() old_pgr = 0 loop = 0 pgr_step = min(50, loops) while loop < loops: loop += 1 if meth == "dyn": w = UiFactory.instance(self._tstui, parent=root) else: w = UiFactory.load(self._tstui, cache=False) if loop == 1: print "_" * 2 * pgr_step pgr = int(loop * pgr_step / loops) if pgr != old_pgr: print "#", old_pgr = pgr widgets.append(w) # time.sleep(1) print '' print datetime.now() - start # os._exit(42) start = datetime.now() log.debug('add to layout ...') for w in widgets: layout.addWidget(w) print datetime.now() - start log.debug('DONE')
def test(typ, num, cls, dt): items = list() log.debug('Create {0} {1} instances', num, typ) while num > 0: num -= 1 items.append(cls(dt)) count = 0 log.debug('Access {0} {1}', len(items), typ) for item in items: dt = item.data count += dt.value log.debug('Done, count {0}', count)
def pre(self): fmt = "[{level:^7}] {time} {message}" os.environ[envvars.DEBUG_LEVEL] = "4" os.environ[envvars.DEBUG_FORMAT] = fmt log.debug('START ON {0}', self.path, box='.')
def main_loader(num, path): log.debug('LOADER {0} instances of {1}', num, path) while num > 0: num -= 1 UiCache.load(path, cache=False) log.debug('DONE')
def bench(self, vray): start = datetime.now() log.debug('... create renderer') scene = vray.VRayRenderer() scene.setOnDumpMessage(self.dumped) scene.setOnProgress(self.progress) log.debug('... load scene') self.old_pgr = 0 scene.load(self.path) log.debug('... parse plugs') with open('C:/work/logs/bench_sdk.log', 'w') as f: for p in scene.plugins: f.write(str(p) + '\n') log.debug('... save scene') self.old_pgr = 0 scene.export('C:/work/tmp/bench.vrscene') log.debug('... close renderer') scene.close() log.debug('... test done') log.debug('Elapsed: {0}', datetime.now() - start, box='>')
def postRun(self, context): log.debug('CUSTOM {0} POST RUN', self.id) code = self.field('post_code') if code and code.value: exec(code.value)
def dbg(msg, *args, **kwargs): log.debug(msg, *args, **kwargs)
import sys import scramble # @UnusedImport from cgev.common import log from cgev.vray import IDRenderer from cgev.vray import RenderIdOpts if __name__ == "__main__": if len(sys.argv) > 1: scene = sys.argv[1] else: scene = "C:/work/scenes/vray/test/labo.vrscene" # scene = "C:/work/scenes/vray/simple/test_export.vrscene" # scene = "C:/work/scenes/vray/test/labo.vrscene" out = "C:/work/tmp/ids/test.exr" opts = RenderIdOpts() opts.resolution = [640, 480] opts.lights = False opts.shaders = False scene = IDRenderer(scene) scene.renderIdPass(out) log.debug("." * 80)
def func1(): log.debug('func 1') func2()
def test_procs(): log.debug('Get processes: ') procs = system.getProcesses() for pid, exe in procs.iteritems(): log.debug('{0} {1}', pid, exe)
if event == "return": print "<" + "-" * indent[0], "exit function", frame.f_code.co_name indent[0] -= 2 return tracefunc sys.settrace(tracefunc) ''' __import__('scramble') from cgev.common import log from cgev.rpc.test import TestClient client = TestClient() log.info('-> hello') log.debug(client.hello()) log.info('-> hi') log.debug(client.hi('yooooo')) delay = int(sys.argv[1]) if len(sys.argv) > 1 else None log.info('-> hey {0}', delay) log.debug(client.hey(None, delay)) ''' while 1: log.info('-> sync {0}', delay) log.debug(client.func_sync(delay)) '''
import scramble # @UnusedImport from cgev.common import log from cgev.pipeline.process import server log.debug('get dirs') shot = server.getShot('test', '001', '001') retake = server.getStatusObj('test', 'Retake') print '' print 'Retake id : {}'.format(retake.getId()) for asset in shot.getAssets(): if asset.getName() != 'labo.maquette': continue print asset.getName() for version in asset.getVersions(): status = version.getStatus() print str(version.getVersion()) + ' - ' + status.getName() version.setStatus(retake) ''' for task in shot.getTasks(): if task.getName() != 'labo': continue
def post(self): log.debug('BENCH DONE', box='.')
import time import scramble from cgev.common import log from cgev.common import debug client = debug.SessionClient() log.debug('Hello response : %s' % str(client.hello())) client.register('Maya 2016') client.register('Maya 2013') client.getRegisteredApplications()
import scramble # @UnusedImport from cgev.common import log from cgev.vray import generate_object_colors, color_id_to_rbg if __name__ == "__main__": max_id = 1000 * 1000 log.debug("... generate {0} ids", max_id) mapping = generate_object_colors(max_id) log.debug("... generation done") if max_id <= 1000: for k, v in mapping.iteritems(): r, g, b = color_id_to_rbg(v) tok = "{0:3d}, {1:3d}, {2:3d}".format(r, g, b) print "{0:5d} = ( {1} ) {2:10d}".format(k, tok, v)