Repository: PrefectHQ/prefect

Issue:
Flow default result handler persists on incompatible storage option change
## Description
If a Flow is initialized then has its storage option changed the default result handler still persists:
```python
@task
def task1():
    return "bad"

with Flow("my-flow") as flow:
    task1()

flow.storage = Docker(...)

flow.register(...)
```

The default result handler of the flow will remain as the `LocalResultHandler` because the default is only populated at initialization https://github.com/PrefectHQ/prefect/blob/master/src/prefect/core/flow.py#L165

I'm not 100% sure this is classified as a bug but it is definitely undesirable behavior. There is an incompatibility of the default result handler and this storage option. I think a simple check that would either change or raise a warning will suffice.

## Expected Behavior
I expect the default result handler to be removed since the Local Result Handler will not work with this storage type.



## Reproduction
Register the flow above from the Description section.



## Environment
`0.9.0`


Discussion:
Happy to take this one on since I found it-- should have it done by end of week.

Resolving patch:
diff --git a/src/prefect/core/flow.py b/src/prefect/core/flow.py
--- a/src/prefect/core/flow.py
+++ b/src/prefect/core/flow.py
@@ -133,8 +133,7 @@ def my_task():
             in the `edges` argument. Defaults to the value of `eager_edge_validation` in
             your prefect configuration file.
         - result_handler (ResultHandler, optional): the handler to use for
-            retrieving and storing state results during execution; if not provided, will default
-            to the one specified in your config
+            retrieving and storing state results during execution
 
     """
 
@@ -162,7 +161,7 @@ def __init__(
         self.schedule = schedule
         self.environment = environment or prefect.environments.RemoteEnvironment()
         self.storage = storage
-        self.result_handler = result_handler or getattr(storage, "result_handler", None)
+        self.result_handler = result_handler
 
         self.tasks = set()  # type: Set[Task]
         self.edges = set()  # type: Set[Edge]


Test patch:
diff --git a/tests/core/test_flow.py b/tests/core/test_flow.py
--- a/tests/core/test_flow.py
+++ b/tests/core/test_flow.py
@@ -136,8 +136,7 @@ def test_create_flow_with_result_handler(self):
     def test_create_flow_with_storage(self):
         f2 = Flow(name="test", storage=prefect.environments.storage.Memory())
         assert isinstance(f2.storage, prefect.environments.storage.Memory)
-        assert isinstance(f2.result_handler, ResultHandler)
-        assert f2.result_handler == f2.storage.result_handler
+        assert f2.result_handler is None
 
     def test_create_flow_with_storage_and_result_handler(self):
         handler = LocalResultHandler(dir="/")
@@ -2230,7 +2229,11 @@ def do_something():
 class TestFlowRegister:
     @pytest.mark.parametrize(
         "storage",
-        ["prefect.environments.storage.Docker", "prefect.environments.storage.Memory"],
+        [
+            "prefect.environments.storage.Docker",
+            "prefect.environments.storage.Memory",
+            "prefect.environments.storage.Local",
+        ],
     )
     def test_flow_register_uses_default_storage(self, monkeypatch, storage):
         monkeypatch.setattr("prefect.Client", MagicMock())
@@ -2241,6 +2244,7 @@ def test_flow_register_uses_default_storage(self, monkeypatch, storage):
             f.register("My-project")
 
         assert isinstance(f.storage, from_qualified_name(storage))
+        assert f.result_handler == from_qualified_name(storage)().result_handler
 
     def test_flow_register_passes_kwargs_to_storage(self, monkeypatch):
         monkeypatch.setattr("prefect.Client", MagicMock())
@@ -2295,8 +2299,7 @@ def test_flow_register_auto_sets_result_handler_if_storage_has_default(
     ):
         monkeypatch.setattr("prefect.Client", MagicMock())
         f = Flow(name="Test me!! I should get labeled", storage=storage)
-        assert isinstance(f.result_handler, ResultHandler)
-        assert f.result_handler == storage.result_handler
+        assert f.result_handler is None
 
         f.result_handler = None
         f.register("My-project", build=False)