def METHOD_NAME(self, samples, ids):
    outputs = []
    # If none is received terminate all subprocesses
    if samples is None:
        for rank in range(self.world_size):
            self.samples_q[rank].put(-1)
        return -1
    self.main_lock.wait()
    self.main_lock.clear()
    for id, batch in zip(ids, samples):
        # Enqueue samples into the multiprocessing queue
        self.dataset_cache[id] = batch
        for rank in range(self.world_size):
            self.samples_q[rank].put(id)
        # Wait for output capture it
        out = self.capture_output(id)
        outputs.append(out)
    self.main_lock.set()
    return outputs