2.82+: How to use fluid.bakeData() in python code
This works to an extent for me on an AWS GPU instance:
for scene in bpy.data.scenes:
for object in scene.objects:
    for modifier in object.modifiers:
        print(object.name, &quot; - modifier type: &quot;, modifier.type)
        if modifier.type == 'FLUID':
            print(object.name, &quot; - fuid_type: &quot;, modifier.fluid_type)
            if modifier.fluid_type == 'DOMAIN':
                print(&quot;Bake All: &quot;, object.name)
                bpy.ops.fluid.bake_all({'scene': scene, 'active_object': object})
                break

The problem I have is that I have three objects