Omniverse Replicator via Python API does not work

I am encountering some problems when running replicator via python API, it finishes without generating images, unlike in isaac-sim.

System:

I have taken the code available here: GitHub - NVIDIA-Omniverse/kit-extension-sample-defectsgen: Reference Extension to apply defects for synthetic data generation and modify to take out all the UI related functions. Once done that I deploy a docker container which can run the core functions which are create_defect_layer and rep.orchestator.run()

def create_defect_layer(defect_params: DefectParameters, object_params: ObjectParameters, system_params: SystemParameters):
    rep.open_stage(system_params.usd_file_path)

    with rep.new_layer("Defect"):

        create_defects(defect_params, object_params)
        create_randomizers(defect_params=defect_params, object_params=object_params)        

        # Create / Get camera
        camera = create_camera(object_params)

        render_product  = rep.create.render_product(camera, (1024, 1024))

        # Initialize and attach writer
        writer = rep.WriterRegistry.get("BasicWriter")
        writer.initialize(output_dir=system_params.output_dir, 
                          rgb=True, 
                          semantic_segmentation=system_params.use_seg, 
                          bounding_box_2d_tight=system_params.use_bb)

        # Attach render_product to the writer
        writer.attach([render_product])

        # Setup randomization
        with rep.trigger.on_frame(num_frames=system_params.frames, rt_subframes=system_params.rt_subframes):
            rep.randomizer.move_defect()
            rep.randomizer.change_defect_image()

                
def run_replicator(defect_params, object_params, system_params):
    remove_replicator_graph(object_params)
    total_frames = system_params.frames

    if total_frames > 0:
        create_defect_layer(defect_params, object_params, system_params)
        rep.orchestrator.run()
    else:
        carb.log_error(f"Number of frames is {total_frames}. Input value needs to be greater than 0.")

The code seems to work, but at some point stops running and no image is generated. If I run the same stage within isaac-sim it does generate images.

Do I need any aditional steps? My final intention is to deploy a service that can take in an image and generate a new one with new defects without the necessity of the isaac-sim UI.

Please find attached the logs:

replicator-docker.txt (40.9 KB)