def exit_if_trainer_done(checkpoint_dir):
    '''Helper method that shutsdown the sim app if the trainer is done
       checkpoint_dir - direcotry where the done file would be downloaded to
    '''
    if should_stop(checkpoint_dir):
        logger.info("Received termination signal from trainer. Goodbye.")
        utils.simapp_exit_gracefully()
def exit_if_trainer_done(checkpoint_dir, s3_writer):
    '''Helper method that shutsdown the sim app if the trainer is done
       checkpoint_dir - direcotry where the done file would be downloaded to
    '''
    if should_stop(checkpoint_dir):
        unsubscribe_from_save_mp4 = ServiceProxyWrapper('/racecar/save_mp4/unsubscribe_from_save_mp4', Empty)
        unsubscribe_from_save_mp4(EmptyRequest())
        s3_writer.upload_to_s3()
        logger.info("Received termination signal from trainer. Goodbye.")
        utils.simapp_exit_gracefully()
Esempio n. 3
0
def exit_if_trainer_done(checkpoint_dir, s3_writer, rollout_idx):
    '''Helper method that shutsdown the sim app if the trainer is done
       checkpoint_dir - direcotry where the done file would be downloaded to
    '''
    if should_stop(checkpoint_dir):
        is_save_mp4_enabled = rospy.get_param('MP4_S3_BUCKET', None) and rollout_idx == 0
        if is_save_mp4_enabled:
            unsubscribe_from_save_mp4 = ServiceProxyWrapper('/racecar/save_mp4/unsubscribe_from_save_mp4', Empty)
            unsubscribe_from_save_mp4(EmptyRequest())
        s3_writer.upload_to_s3()
        logger.info("Received termination signal from trainer. Goodbye.")
        simapp_exit_gracefully()
def exit_if_trainer_done(checkpoint_dir, simtrace_video_s3_writers, rollout_idx):
    """Helper method that shutsdown the sim app if the trainer is done
    checkpoint_dir - direcotry where the done file would be downloaded to
    """
    if should_stop(checkpoint_dir):
        is_save_mp4_enabled = rospy.get_param("MP4_S3_BUCKET", None) and rollout_idx == 0
        if is_save_mp4_enabled:
            unsubscribe_from_save_mp4 = ServiceProxyWrapper(
                "/racecar/save_mp4/unsubscribe_from_save_mp4", Empty
            )
            unsubscribe_from_save_mp4(EmptyRequest())
        # upload simtrace and mp4 into s3 bucket
        for s3_writer in simtrace_video_s3_writers:
            s3_writer.persist(utils.get_s3_kms_extra_args())
        logger.info("Received termination signal from trainer. Goodbye.")
        simapp_exit_gracefully()