def _write_and_upload_video(clip_data, frames, clip_id, source, fps, gcs_path,
                            video_local_path, clip_local_path):
    with open(clip_local_path, 'wb') as f:
        pickle.dump(clip_data, f)  # Write clip to disk
    write_segment_to_video(frames, fname=video_local_path, fps=fps)
    upload_to_gcs(video_local_path, gcs_path)
    return clip_id, source
def test_upload():
    bucket = os.environ.get('RL_TEACHER_GCS_BUCKET')
    assert bucket and bucket.startswith(
        "gs://"
    ), "env variable RL_TEACHER_GCS_BUCKET must be set and start with gs://"

    gcs_path = 'test_obs_75.mp4'
    dest_path = osp.join(bucket, gcs_path)
    upload_to_gcs(osp.join(TEST_RENDER_DIR, 'test-0.mp4'), dest_path)
示例#3
0
def _write_and_upload_video(env_id, gcs_path, local_path, segment):
    env = make_with_torque_removed(env_id)
    write_segment_to_video(segment, fname=local_path, env=env)
    upload_to_gcs(local_path, gcs_path)