prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Hydra client API
  Create Hydra client API to allow jobs to interact with Hydra.
  one immediate need is to allow executed code to find out what is the original working directory is was executed from.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `hydra/utils.py`
  Content:
  ```
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 import logging.config
  3 
  4 from omegaconf import OmegaConf
  5 
  6 # pylint: disable=C0103
  7 log = logging.getLogger(__name__)
  8 
  9 
  10 def get_method(path):
  11     return get_class(path)
  12 
  13 
  14 def get_class(path):
  15     try:
  16         from importlib import import_module
  17 
  18         module_path, _, class_name = path.rpartition(".")
  19         mod = import_module(module_path)
  20         try:
  21             klass = getattr(mod, class_name)
  22         except AttributeError:
  23             raise ImportError(
  24                 "Class {} is not in module {}".format(class_name, module_path)
  25             )
  26         return klass
  27     except ValueError as e:
  28         log.error("Error initializing class " + path)
  29         raise e
  30 
  31 
  32 def get_static_method(full_method_name):
  33     try:
  34         spl = full_method_name.split(".")
  35         method_name = spl.pop()
  36         class_name = ".".join(spl)
  37         clz = get_class(class_name)
  38         return getattr(clz, method_name)
  39     except Exception as e:
  40         log.error("Error getting static method {} : {}".format(full_method_name, e))
  41         raise e
  42 
  43 
  44 def instantiate(config, *args, **kwargs):
  45     assert config is not None, "Input config is None"
  46     try:
  47         clazz = get_class(config["class"])
  48         params = config.params if "params" in config else OmegaConf.create()
  49         params.merge_with(OmegaConf.create(kwargs))
  50         return clazz(*args, **params)
  51     except Exception as e:
  52         log.error("Error instantiating {} : {}".format(config["class"], e))
  53         raise e
  54
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/hydra/utils.py b/hydra/utils.py
  --- a/hydra/utils.py
  +++ b/hydra/utils.py
  @@ -3,6 +3,9 @@
   
   from omegaconf import OmegaConf
   
  +from hydra._internal.pathlib import Path
  +from hydra.plugins.common.utils import HydraConfig
  +
   # pylint: disable=C0103
   log = logging.getLogger(__name__)
   
  @@ -51,3 +54,23 @@
       except Exception as e:
           log.error("Error instantiating {} : {}".format(config["class"], e))
           raise e
  +
  +
  +def get_original_cwd():
  +    return HydraConfig().hydra.runtime.cwd
  +
  +
  +def to_absolute_path(path):
  +    """
  +    converts the specified path to be absolute path.
  +    if the input path is relative, it's interpreted as relative to the original working directory
  +    if it's absolute, it's returned as is
  +    :param path:
  +    :return:
  +    """
  +    path = Path(path)
  +    if path.is_absolute():
  +        ret = path
  +    else:
  +        ret = Path(get_original_cwd()) / path
  +    return str(ret)
  
verification_info: {"golden_diff": "diff --git a/hydra/utils.py b/hydra/utils.py\n--- a/hydra/utils.py\n+++ b/hydra/utils.py\n@@ -3,6 +3,9 @@\n \n from omegaconf import OmegaConf\n \n+from hydra._internal.pathlib import Path\n+from hydra.plugins.common.utils import HydraConfig\n+\n # pylint: disable=C0103\n log = logging.getLogger(__name__)\n \n@@ -51,3 +54,23 @@\n     except Exception as e:\n         log.error(\"Error instantiating {} : {}\".format(config[\"class\"], e))\n         raise e\n+\n+\n+def get_original_cwd():\n+    return HydraConfig().hydra.runtime.cwd\n+\n+\n+def to_absolute_path(path):\n+    \"\"\"\n+    converts the specified path to be absolute path.\n+    if the input path is relative, it's interpreted as relative to the original working directory\n+    if it's absolute, it's returned as is\n+    :param path:\n+    :return:\n+    \"\"\"\n+    path = Path(path)\n+    if path.is_absolute():\n+        ret = path\n+    else:\n+        ret = Path(get_original_cwd()) / path\n+    return str(ret)\n", "issue": "Hydra client API\nCreate Hydra client API to allow jobs to interact with Hydra.\r\none immediate need is to allow executed code to find out what is the original working directory is was executed from.\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging.config\n\nfrom omegaconf import OmegaConf\n\n# pylint: disable=C0103\nlog = logging.getLogger(__name__)\n\n\ndef get_method(path):\n    return get_class(path)\n\n\ndef get_class(path):\n    try:\n        from importlib import import_module\n\n        module_path, _, class_name = path.rpartition(\".\")\n        mod = import_module(module_path)\n        try:\n            klass = getattr(mod, class_name)\n        except AttributeError:\n            raise ImportError(\n                \"Class {} is not in module {}\".format(class_name, module_path)\n            )\n        return klass\n    except ValueError as e:\n        log.error(\"Error initializing class \" + path)\n        raise e\n\n\ndef get_static_method(full_method_name):\n    try:\n        spl = full_method_name.split(\".\")\n        method_name = spl.pop()\n        class_name = \".\".join(spl)\n        clz = get_class(class_name)\n        return getattr(clz, method_name)\n    except Exception as e:\n        log.error(\"Error getting static method {} : {}\".format(full_method_name, e))\n        raise e\n\n\ndef instantiate(config, *args, **kwargs):\n    assert config is not None, \"Input config is None\"\n    try:\n        clazz = get_class(config[\"class\"])\n        params = config.params if \"params\" in config else OmegaConf.create()\n        params.merge_with(OmegaConf.create(kwargs))\n        return clazz(*args, **params)\n    except Exception as e:\n        log.error(\"Error instantiating {} : {}\".format(config[\"class\"], e))\n        raise e\n", "path": "hydra/utils.py"}], "after_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging.config\n\nfrom omegaconf import OmegaConf\n\nfrom hydra._internal.pathlib import Path\nfrom hydra.plugins.common.utils import HydraConfig\n\n# pylint: disable=C0103\nlog = logging.getLogger(__name__)\n\n\ndef get_method(path):\n    return get_class(path)\n\n\ndef get_class(path):\n    try:\n        from importlib import import_module\n\n        module_path, _, class_name = path.rpartition(\".\")\n        mod = import_module(module_path)\n        try:\n            klass = getattr(mod, class_name)\n        except AttributeError:\n            raise ImportError(\n                \"Class {} is not in module {}\".format(class_name, module_path)\n            )\n        return klass\n    except ValueError as e:\n        log.error(\"Error initializing class \" + path)\n        raise e\n\n\ndef get_static_method(full_method_name):\n    try:\n        spl = full_method_name.split(\".\")\n        method_name = spl.pop()\n        class_name = \".\".join(spl)\n        clz = get_class(class_name)\n        return getattr(clz, method_name)\n    except Exception as e:\n        log.error(\"Error getting static method {} : {}\".format(full_method_name, e))\n        raise e\n\n\ndef instantiate(config, *args, **kwargs):\n    assert config is not None, \"Input config is None\"\n    try:\n        clazz = get_class(config[\"class\"])\n        params = config.params if \"params\" in config else OmegaConf.create()\n        params.merge_with(OmegaConf.create(kwargs))\n        return clazz(*args, **params)\n    except Exception as e:\n        log.error(\"Error instantiating {} : {}\".format(config[\"class\"], e))\n        raise e\n\n\ndef get_original_cwd():\n    return HydraConfig().hydra.runtime.cwd\n\n\ndef to_absolute_path(path):\n    \"\"\"\n    converts the specified path to be absolute path.\n    if the input path is relative, it's interpreted as relative to the original working directory\n    if it's absolute, it's returned as is\n    :param path:\n    :return:\n    \"\"\"\n    path = Path(path)\n    if path.is_absolute():\n        ret = path\n    else:\n        ret = Path(get_original_cwd()) / path\n    return str(ret)\n", "path": "hydra/utils.py"}]}