facebook360_dep
Facebook360 Depth Estimation Pipeline
Classes | Functions | Variables
scripts.render.setup Namespace Reference

Classes

class  RepeatedTimer
 

Functions

def init_facebook360_dep (gflags)
 
def set_glog_env (gflags)
 
def setup_logging_handler (log_dir)
 
def terminate_handler ()
 
def sigterm_handler (signal, frame)
 
def setup_termination_handlers (sigterm_handler=sigterm_handler)
 
def define_flags ()
 
def log_flags ()
 
def docker_mounts (input_root, host_to_docker_path, username, password)
 
def docker_run_cmd (ip, docker_img=config.DOCKER_IMAGE)
 
def configure_worker_daemon (ip)
 
def spawn_worker (ip, num_containers, run_async)
 
def spawn_worker_local (replica)
 
def setup_master (base_params)
 
def setup_workers (base_params)
 
def cleanup_workers ()
 

Variables

 dir_scripts = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
 dir_root = os.path.dirname(dir_scripts)
 
 FLAGS = flags.FLAGS
 
 flag_names = set()
 
list child_pids = []
 
 facebook360_dep_root = str(Path(os.path.abspath(__file__)).parents[2])
 
 source_root = os.path.join(facebook360_dep_root, "source")
 
 depth_est_src = os.path.join(source_root, "depth_estimation")
 
dictionary bin_to_flags
 

Function Documentation

◆ cleanup_workers()

def scripts.render.setup.cleanup_workers ( )
Destroys the worker process if running locally.

◆ configure_worker_daemon()

def scripts.render.setup.configure_worker_daemon (   ip)
Configures the Docker daemon to accept HTTP connections for using the local registry.

Args:
    ip (str): IP of the worker.

◆ define_flags()

def scripts.render.setup.define_flags ( )
Defines abseil flags for render.

◆ docker_mounts()

def scripts.render.setup.docker_mounts (   input_root,
  host_to_docker_path,
  username,
  password 
)
Constructs a list of the relevant commands to mount the external paths.
The mounts are performed as commands if on a LAN and are volume mounts if
for a single node.

Args:
    input_root (str): Path to the root of inputs.
    host_to_docker_path (dict[str, str]): Map of local paths to path inside container.
    username (str): Username for SMB drive. Can be blank if no username is used
        for the drive or if rendering locally.
    password (str): Password for SMB drive. Can be blank if no password is used
        for the drive or if rendering locally.

Returns:
    list[str]: List of Docker mount commands

◆ docker_run_cmd()

def scripts.render.setup.docker_run_cmd (   ip,
  docker_img = config.DOCKER_IMAGE 
)
Constructs the command to run the Docker container. The container will map all
the desired endpoints to the canonical structure internally.

Args:
    ip (str): IP of the master.
    docker_img (str, optional): Name of the docker image.

Returns:
    str: Command to run the configured Docker container.

◆ init_facebook360_dep()

def scripts.render.setup.init_facebook360_dep (   gflags)
Sets up the environment with expected values and handlers.

Args:
    gflags (absl.flags._flagvalues.FlagValues): Globally defined flags.

◆ log_flags()

def scripts.render.setup.log_flags ( )
Prints formatted list of flags and their values.

◆ set_glog_env()

def scripts.render.setup.set_glog_env (   gflags)
Sets up GLOG environment variables.

Args:
    gflags (absl.flags._flagvalues.FlagValues): Globally defined flags.

◆ setup_logging_handler()

def scripts.render.setup.setup_logging_handler (   log_dir)
Sets up logging.

Args:
    log_dir (str): Path to directory where logs should be saved.

◆ setup_master()

def scripts.render.setup.setup_master (   base_params)
Sets up the master node for rendering.

Args:
    base_params (dict[str, _]): Map of all the FLAGS defined in render.py.

◆ setup_termination_handlers()

def scripts.render.setup.setup_termination_handlers (   sigterm_handler = sigterm_handler)
Sets up a handler for all termination signals.

Args:
    sigterm_handler (func: (signal.signal, frame) -> void, optional): Function for handling
        termination signals.

◆ setup_workers()

def scripts.render.setup.setup_workers (   base_params)
Sets up the worker nodes for rendering.

Args:
    base_params (dict[str, _]): Map of all the FLAGS defined in render.py.

◆ sigterm_handler()

def scripts.render.setup.sigterm_handler (   signal,
  frame 
)
Handler for any catchable signal that terminates the program.

Args:
    signal (signal.signal): Type of signal.
    frame (frame): Stack frame.

◆ spawn_worker()

def scripts.render.setup.spawn_worker (   ip,
  num_containers,
  run_async 
)
Creates worker container(s) on the desired IP.

Args:
    ip (str): IP of the machine to run the worker container.
    num_containers (int): Number of containers to be run.
    run_async (bool): Whether the spawning should happen synchronously or not.

◆ spawn_worker_local()

def scripts.render.setup.spawn_worker_local (   replica)
Starts a worker locally.

Args:
    replica (int): Replica ID of the worker being spawned.

◆ terminate_handler()

def scripts.render.setup.terminate_handler ( )
Cleans workers before terminating the program.

Variable Documentation

◆ bin_to_flags

dictionary scripts.render.setup.bin_to_flags
Initial value:
1 = {
2  "TemporalBilateralFilter": get_flags(
3  os.path.join(depth_est_src, "TemporalBilateralFilter.cpp")
4  ),
5  "ConvertToBinary": get_flags(
6  os.path.join(source_root, "mesh_stream", "ConvertToBinary.cpp")
7  ),
8  "DerpCLI": get_flags(os.path.join(depth_est_src, "DerpCLI.cpp")),
9  "GenerateForegroundMasks": get_flags(
10  os.path.join(source_root, "render", "GenerateForegroundMasks.cpp")
11  ),
12  "LayerDisparities": get_flags(os.path.join(depth_est_src, "LayerDisparities.cpp")),
13  "SimpleMeshRenderer": get_flags(
14  os.path.join(source_root, "render", "SimpleMeshRenderer.cpp")
15  ),
16  "UpsampleDisparity": get_flags(
17  os.path.join(depth_est_src, "UpsampleDisparity.cpp")
18  ),
19 }
def get_flags(source)
Definition: system_util.py:97

◆ child_pids

list scripts.render.setup.child_pids = []

◆ depth_est_src

scripts.render.setup.depth_est_src = os.path.join(source_root, "depth_estimation")

◆ dir_root

scripts.render.setup.dir_root = os.path.dirname(dir_scripts)

◆ dir_scripts

scripts.render.setup.dir_scripts = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

◆ facebook360_dep_root

scripts.render.setup.facebook360_dep_root = str(Path(os.path.abspath(__file__)).parents[2])

◆ flag_names

scripts.render.setup.flag_names = set()

◆ FLAGS

scripts.render.setup.FLAGS = flags.FLAGS

◆ source_root

scripts.render.setup.source_root = os.path.join(facebook360_dep_root, "source")