def run_worker_process(): try: lm.init('user::default', {}) lm.info() lm.log.setSeverity(1000) lm.log.log(lm.log.LogLevel.Err, lm.log.LogLevel.Info, '', 0, 'pid={}'.format(os.getpid())) lm.dist.worker.init('dist::worker::default', { 'name': uuid.uuid4().hex, 'address': 'localhost', 'port': 5000, 'numThreads': 1 }) lm.dist.worker.run() lm.dist.shutdown() lm.shutdown() except Exception: tr = traceback.print_exc() lm.log.log(lm.log.LogLevel.Err, lm.log.LogLevel.Info, '', 0, str(tr))
# - lm.init() # + {"raw_mimetype": "text/restructuredtext", "active": ""} # Logging and progress reporting in Jupyter notebook can be enabled by :cpp:func:`lm::log::init` and :cpp:func:`lm::progress::init` functions with corresponding types. # - lm.log.init('jupyter') lm.progress.init('jupyter') # + {"raw_mimetype": "text/restructuredtext", "active": ""} # Once the framework has been initialized properly, you can get an splash message using :cpp:func:`lm::info()` function. # - lm.info() # + {"raw_mimetype": "text/restructuredtext", "active": ""} # Next we define `assets` necessary to execute renderer, like materials, meshes, etc. In this example, we only need a `film` to which the renderer outputs the image. We can define assets by ``lm::load_*`` function, where ``*`` represents the name of the asset. In this example, we want to make ``film`` asset. So we use :cpp:func:`lm::load_film` function. # # The first argument (``film``) specifies id of the asset to be referenced. The second argument (``bitmap``) is given as the type of the assets. # The optional keyword arguments specify the parameters passed to the instance. # # For convenicence, we will refer to the asset of the specific type in ``<asset type>::<name>`` format. For instance, ``film::bitmap`` represents a `bitmap film` asset. ``film::bitmap`` takes two parameters ``w`` and ``h`` which respectively specify width and height of the film. # # This function returns a reference to the asset. You can access the underlying member functions. You can find details in :ref:`api_ref`. # - film = lm.load_film('film', 'bitmap', w=1920, h=1080) # + {"raw_mimetype": "text/restructuredtext", "active": ""}