prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add more details to Callback doc
  (from zulip chat)
  > When are the Callbacks executed in the hydra stack exactly? More specifically, are they executed after the launchers in the environments that the launchers provide? (Would be awesome to add a sentence about this in the docs)
  
  
  </issue>
  <code>
  [start of hydra/experimental/callback.py]
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 import logging
  3 from typing import Any
  4 
  5 from omegaconf import DictConfig
  6 
  7 from hydra.core.utils import JobReturn
  8 
  9 logger = logging.getLogger(__name__)
  10 
  11 
  12 class Callback:
  13     def on_run_start(self, config: DictConfig, **kwargs: Any) -> None:
  14         """
  15         Called in RUN mode before job starts.
  16         """
  17         ...
  18 
  19     def on_run_end(self, config: DictConfig, **kwargs: Any) -> None:
  20         """
  21         Called in RUN mode after job ends.
  22         """
  23         ...
  24 
  25     def on_multirun_start(self, config: DictConfig, **kwargs: Any) -> None:
  26         """
  27         Called in MULTIRUN mode before any job starts.
  28         """
  29         ...
  30 
  31     def on_multirun_end(self, config: DictConfig, **kwargs: Any) -> None:
  32         """
  33         Called in MULTIRUN mode after all jobs end.
  34         """
  35         ...
  36 
  37     def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:
  38         """
  39         Called in both RUN and MULTIRUN modes, once for each Hydra job (before running
  40         application code).
  41         """
  42         ...
  43 
  44     def on_job_end(
  45         self, config: DictConfig, job_return: JobReturn, **kwargs: Any
  46     ) -> None:
  47         """
  48         Called in both RUN and MULTIRUN modes, once for each Hydra job (after running
  49         application code).
  50         """
  51         ...
  52
  [end of hydra/experimental/callback.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/hydra/experimental/callback.py b/hydra/experimental/callback.py
  --- a/hydra/experimental/callback.py
  +++ b/hydra/experimental/callback.py
  @@ -12,32 +12,37 @@
   class Callback:
       def on_run_start(self, config: DictConfig, **kwargs: Any) -> None:
           """
  -        Called in RUN mode before job starts.
  +        Called in RUN mode before job/application code starts. `config` is composed with overrides.
  +        Some `hydra.runtime` configs are not populated yet.
  +        See hydra.core.utils.run_job for more info.
           """
           ...
   
       def on_run_end(self, config: DictConfig, **kwargs: Any) -> None:
           """
  -        Called in RUN mode after job ends.
  +        Called in RUN mode after job/application code returns.
           """
           ...
   
       def on_multirun_start(self, config: DictConfig, **kwargs: Any) -> None:
           """
           Called in MULTIRUN mode before any job starts.
  +        When using a launcher, this will be executed on local machine before any Sweeper/Launcher is initialized.
           """
           ...
   
       def on_multirun_end(self, config: DictConfig, **kwargs: Any) -> None:
           """
  -        Called in MULTIRUN mode after all jobs end.
  +        Called in MULTIRUN mode after all jobs returns.
  +        When using a launcher, this will be executed on local machine.
           """
           ...
   
       def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:
           """
  -        Called in both RUN and MULTIRUN modes, once for each Hydra job (before running
  -        application code).
  +        Called in both RUN and MULTIRUN modes, once for each Hydra job (before running application code).
  +        This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed
  +        on the remote server along with your application code.
           """
           ...
   
  @@ -47,5 +52,10 @@
           """
           Called in both RUN and MULTIRUN modes, once for each Hydra job (after running
           application code).
  +        This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed
  +        on the remote server after your application code.
  +
  +        `job_return` contains info that could be useful for logging or post-processing.
  +        See hydra.core.utils.JobReturn for more.
           """
           ...
  
verification_info: {"golden_diff": "diff --git a/hydra/experimental/callback.py b/hydra/experimental/callback.py\n--- a/hydra/experimental/callback.py\n+++ b/hydra/experimental/callback.py\n@@ -12,32 +12,37 @@\n class Callback:\n     def on_run_start(self, config: DictConfig, **kwargs: Any) -> None:\n         \"\"\"\n-        Called in RUN mode before job starts.\n+        Called in RUN mode before job/application code starts. `config` is composed with overrides.\n+        Some `hydra.runtime` configs are not populated yet.\n+        See hydra.core.utils.run_job for more info.\n         \"\"\"\n         ...\n \n     def on_run_end(self, config: DictConfig, **kwargs: Any) -> None:\n         \"\"\"\n-        Called in RUN mode after job ends.\n+        Called in RUN mode after job/application code returns.\n         \"\"\"\n         ...\n \n     def on_multirun_start(self, config: DictConfig, **kwargs: Any) -> None:\n         \"\"\"\n         Called in MULTIRUN mode before any job starts.\n+        When using a launcher, this will be executed on local machine before any Sweeper/Launcher is initialized.\n         \"\"\"\n         ...\n \n     def on_multirun_end(self, config: DictConfig, **kwargs: Any) -> None:\n         \"\"\"\n-        Called in MULTIRUN mode after all jobs end.\n+        Called in MULTIRUN mode after all jobs returns.\n+        When using a launcher, this will be executed on local machine.\n         \"\"\"\n         ...\n \n     def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:\n         \"\"\"\n-        Called in both RUN and MULTIRUN modes, once for each Hydra job (before running\n-        application code).\n+        Called in both RUN and MULTIRUN modes, once for each Hydra job (before running application code).\n+        This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed\n+        on the remote server along with your application code.\n         \"\"\"\n         ...\n \n@@ -47,5 +52,10 @@\n         \"\"\"\n         Called in both RUN and MULTIRUN modes, once for each Hydra job (after running\n         application code).\n+        This is called from within `hydra.core.utils.run_job`. In the case of remote launching, this will be executed\n+        on the remote server after your application code.\n+\n+        `job_return` contains info that could be useful for logging or post-processing.\n+        See hydra.core.utils.JobReturn for more.\n         \"\"\"\n         ...\n", "issue": "Add more details to Callback doc\n(from zulip chat)\r\n> When are the Callbacks executed in the hydra stack exactly? More specifically, are they executed after the launchers in the environments that the launchers provide? (Would be awesome to add a sentence about this in the docs)\r\n\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nfrom typing import Any\n\nfrom omegaconf import DictConfig\n\nfrom hydra.core.utils import JobReturn\n\nlogger = logging.getLogger(__name__)\n\n\nclass Callback:\n    def on_run_start(self, config: DictConfig, **kwargs: Any) -> None:\n        \"\"\"\n        Called in RUN mode before job starts.\n        \"\"\"\n        ...\n\n    def on_run_end(self, config: DictConfig, **kwargs: Any) -> None:\n        \"\"\"\n        Called in RUN mode after job ends.\n        \"\"\"\n        ...\n\n    def on_multirun_start(self, config: DictConfig, **kwargs: Any) -> None:\n        \"\"\"\n        Called in MULTIRUN mode before any job starts.\n        \"\"\"\n        ...\n\n    def on_multirun_end(self, config: DictConfig, **kwargs: Any) -> None:\n        \"\"\"\n        Called in MULTIRUN mode after all jobs end.\n        \"\"\"\n        ...\n\n    def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:\n        \"\"\"\n        Called in both RUN and MULTIRUN modes, once for each Hydra job (before running\n        application code).\n        \"\"\"\n        ...\n\n    def on_job_end(\n        self, config: DictConfig, job_return: JobReturn, **kwargs: Any\n    ) -> None:\n        \"\"\"\n        Called in both RUN and MULTIRUN modes, once for each Hydra job (after running\n        application code).\n        \"\"\"\n        ...\n", "path": "hydra/experimental/callback.py"}]}