prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Remove unnecessary Ansible callback for profile_tasks
  # Feature request
  
  ## Description
  
  The file at `install_files/ansible-base/callback_plugins/profile_tasks.py` was added via #1196, to provide additional information on task performance, with the goal of aiding developers in improving the server config workflow. Since we moved to Ansible v2 in #1146, the hardcoded plugin is no longer necessary.
  
  Instead, we can ansible add a lint to `ansible.cfg` under `[defaults]`:
  
  ```
  callback_whitelist = profile_tasks
  ```
  
  The simplification is possible because task profiling was [added to Ansible core as of v2](https://docs.ansible.com/ansible/devel/plugins/callback/profile_tasks.html).
  
  ## User Stories
  As a maintainer, I want to delete redundant code wherever possible, and lean on upstream to handle core functionality when appropriate.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `install_files/ansible-base/callback_plugins/profile_tasks.py`
  Content:
  ```
  1 # Source: https://github.com/jlafon/ansible-profile
  2 # License: MIT
  3 # More info: http://jlafon.io/ansible-profiling.html
  4 # The profiling functionality will be provided by Ansible v2,
  5 # since this callback_plugin has been merged into core,
  6 # but we're including here to support older versions of Ansible.
  7 import datetime
  8 import os
  9 import time
  10 
  11 
  12 class CallbackModule(object):
  13     """
  14     A plugin for timing tasks
  15     """
  16     def __init__(self):
  17         self.stats = {}
  18         self.current = None
  19 
  20     def playbook_on_task_start(self, name, is_conditional):
  21         """
  22         Logs the start of each task
  23         """
  24 
  25         if os.getenv("ANSIBLE_PROFILE_DISABLE") is not None:
  26             return
  27 
  28         if self.current is not None:
  29             # Record the running time of the last executed task
  30             self.stats[self.current] = time.time() - self.stats[self.current]
  31 
  32         # Record the start time of the current task
  33         self.current = name
  34         self.stats[self.current] = time.time()
  35 
  36     def playbook_on_stats(self, stats):
  37         """
  38         Prints the timings
  39         """
  40 
  41         if os.getenv("ANSIBLE_PROFILE_DISABLE") is not None:
  42             return
  43 
  44         # Record the timing of the very last task
  45         if self.current is not None:
  46             self.stats[self.current] = time.time() - self.stats[self.current]
  47 
  48         # Sort the tasks by their running time
  49         results = sorted(
  50             self.stats.items(),
  51             key=lambda value: value[1],
  52             reverse=True,
  53         )
  54 
  55         # Just keep the top 10
  56         results = results[:10]
  57 
  58         # Print the timings
  59         for name, elapsed in results:
  60             print(
  61                 "{0:-<70}{1:->9}".format(
  62                     '{0} '.format(name),
  63                     ' {0:.02f}s'.format(elapsed),
  64                 )
  65             )
  66 
  67         total_seconds = sum([x[1] for x in self.stats.items()])
  68         print("\nPlaybook finished: {0}, {1} total tasks."
  69               " {2} elapsed. \n".format(
  70                 time.asctime(),
  71                 len(self.stats.items()),
  72                 datetime.timedelta(seconds=(int(total_seconds)))
  73                 )
  74               )
  75
  ```
  --- 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/install_files/ansible-base/callback_plugins/profile_tasks.py b/install_files/ansible-base/callback_plugins/profile_tasks.py
  deleted file mode 100644
  --- a/install_files/ansible-base/callback_plugins/profile_tasks.py
  +++ /dev/null
  @@ -1,74 +0,0 @@
  -# Source: https://github.com/jlafon/ansible-profile
  -# License: MIT
  -# More info: http://jlafon.io/ansible-profiling.html
  -# The profiling functionality will be provided by Ansible v2,
  -# since this callback_plugin has been merged into core,
  -# but we're including here to support older versions of Ansible.
  -import datetime
  -import os
  -import time
  -
  -
  -class CallbackModule(object):
  -    """
  -    A plugin for timing tasks
  -    """
  -    def __init__(self):
  -        self.stats = {}
  -        self.current = None
  -
  -    def playbook_on_task_start(self, name, is_conditional):
  -        """
  -        Logs the start of each task
  -        """
  -
  -        if os.getenv("ANSIBLE_PROFILE_DISABLE") is not None:
  -            return
  -
  -        if self.current is not None:
  -            # Record the running time of the last executed task
  -            self.stats[self.current] = time.time() - self.stats[self.current]
  -
  -        # Record the start time of the current task
  -        self.current = name
  -        self.stats[self.current] = time.time()
  -
  -    def playbook_on_stats(self, stats):
  -        """
  -        Prints the timings
  -        """
  -
  -        if os.getenv("ANSIBLE_PROFILE_DISABLE") is not None:
  -            return
  -
  -        # Record the timing of the very last task
  -        if self.current is not None:
  -            self.stats[self.current] = time.time() - self.stats[self.current]
  -
  -        # Sort the tasks by their running time
  -        results = sorted(
  -            self.stats.items(),
  -            key=lambda value: value[1],
  -            reverse=True,
  -        )
  -
  -        # Just keep the top 10
  -        results = results[:10]
  -
  -        # Print the timings
  -        for name, elapsed in results:
  -            print(
  -                "{0:-<70}{1:->9}".format(
  -                    '{0} '.format(name),
  -                    ' {0:.02f}s'.format(elapsed),
  -                )
  -            )
  -
  -        total_seconds = sum([x[1] for x in self.stats.items()])
  -        print("\nPlaybook finished: {0}, {1} total tasks."
  -              " {2} elapsed. \n".format(
  -                time.asctime(),
  -                len(self.stats.items()),
  -                datetime.timedelta(seconds=(int(total_seconds)))
  -                )
  -              )
  
verification_info: {"golden_diff": "diff --git a/install_files/ansible-base/callback_plugins/profile_tasks.py b/install_files/ansible-base/callback_plugins/profile_tasks.py\ndeleted file mode 100644\n--- a/install_files/ansible-base/callback_plugins/profile_tasks.py\n+++ /dev/null\n@@ -1,74 +0,0 @@\n-# Source: https://github.com/jlafon/ansible-profile\n-# License: MIT\n-# More info: http://jlafon.io/ansible-profiling.html\n-# The profiling functionality will be provided by Ansible v2,\n-# since this callback_plugin has been merged into core,\n-# but we're including here to support older versions of Ansible.\n-import datetime\n-import os\n-import time\n-\n-\n-class CallbackModule(object):\n-    \"\"\"\n-    A plugin for timing tasks\n-    \"\"\"\n-    def __init__(self):\n-        self.stats = {}\n-        self.current = None\n-\n-    def playbook_on_task_start(self, name, is_conditional):\n-        \"\"\"\n-        Logs the start of each task\n-        \"\"\"\n-\n-        if os.getenv(\"ANSIBLE_PROFILE_DISABLE\") is not None:\n-            return\n-\n-        if self.current is not None:\n-            # Record the running time of the last executed task\n-            self.stats[self.current] = time.time() - self.stats[self.current]\n-\n-        # Record the start time of the current task\n-        self.current = name\n-        self.stats[self.current] = time.time()\n-\n-    def playbook_on_stats(self, stats):\n-        \"\"\"\n-        Prints the timings\n-        \"\"\"\n-\n-        if os.getenv(\"ANSIBLE_PROFILE_DISABLE\") is not None:\n-            return\n-\n-        # Record the timing of the very last task\n-        if self.current is not None:\n-            self.stats[self.current] = time.time() - self.stats[self.current]\n-\n-        # Sort the tasks by their running time\n-        results = sorted(\n-            self.stats.items(),\n-            key=lambda value: value[1],\n-            reverse=True,\n-        )\n-\n-        # Just keep the top 10\n-        results = results[:10]\n-\n-        # Print the timings\n-        for name, elapsed in results:\n-            print(\n-                \"{0:-<70}{1:->9}\".format(\n-                    '{0} '.format(name),\n-                    ' {0:.02f}s'.format(elapsed),\n-                )\n-            )\n-\n-        total_seconds = sum([x[1] for x in self.stats.items()])\n-        print(\"\\nPlaybook finished: {0}, {1} total tasks.\"\n-              \" {2} elapsed. \\n\".format(\n-                time.asctime(),\n-                len(self.stats.items()),\n-                datetime.timedelta(seconds=(int(total_seconds)))\n-                )\n-              )\n", "issue": "Remove unnecessary Ansible callback for profile_tasks\n# Feature request\r\n\r\n## Description\r\n\r\nThe file at `install_files/ansible-base/callback_plugins/profile_tasks.py` was added via #1196, to provide additional information on task performance, with the goal of aiding developers in improving the server config workflow. Since we moved to Ansible v2 in #1146, the hardcoded plugin is no longer necessary.\r\n\r\nInstead, we can ansible add a lint to `ansible.cfg` under `[defaults]`:\r\n\r\n```\r\ncallback_whitelist = profile_tasks\r\n```\r\n\r\nThe simplification is possible because task profiling was [added to Ansible core as of v2](https://docs.ansible.com/ansible/devel/plugins/callback/profile_tasks.html).\r\n\r\n## User Stories\r\nAs a maintainer, I want to delete redundant code wherever possible, and lean on upstream to handle core functionality when appropriate.\r\n\n", "before_files": [{"content": "# Source: https://github.com/jlafon/ansible-profile\n# License: MIT\n# More info: http://jlafon.io/ansible-profiling.html\n# The profiling functionality will be provided by Ansible v2,\n# since this callback_plugin has been merged into core,\n# but we're including here to support older versions of Ansible.\nimport datetime\nimport os\nimport time\n\n\nclass CallbackModule(object):\n    \"\"\"\n    A plugin for timing tasks\n    \"\"\"\n    def __init__(self):\n        self.stats = {}\n        self.current = None\n\n    def playbook_on_task_start(self, name, is_conditional):\n        \"\"\"\n        Logs the start of each task\n        \"\"\"\n\n        if os.getenv(\"ANSIBLE_PROFILE_DISABLE\") is not None:\n            return\n\n        if self.current is not None:\n            # Record the running time of the last executed task\n            self.stats[self.current] = time.time() - self.stats[self.current]\n\n        # Record the start time of the current task\n        self.current = name\n        self.stats[self.current] = time.time()\n\n    def playbook_on_stats(self, stats):\n        \"\"\"\n        Prints the timings\n        \"\"\"\n\n        if os.getenv(\"ANSIBLE_PROFILE_DISABLE\") is not None:\n            return\n\n        # Record the timing of the very last task\n        if self.current is not None:\n            self.stats[self.current] = time.time() - self.stats[self.current]\n\n        # Sort the tasks by their running time\n        results = sorted(\n            self.stats.items(),\n            key=lambda value: value[1],\n            reverse=True,\n        )\n\n        # Just keep the top 10\n        results = results[:10]\n\n        # Print the timings\n        for name, elapsed in results:\n            print(\n                \"{0:-<70}{1:->9}\".format(\n                    '{0} '.format(name),\n                    ' {0:.02f}s'.format(elapsed),\n                )\n            )\n\n        total_seconds = sum([x[1] for x in self.stats.items()])\n        print(\"\\nPlaybook finished: {0}, {1} total tasks.\"\n              \" {2} elapsed. \\n\".format(\n                time.asctime(),\n                len(self.stats.items()),\n                datetime.timedelta(seconds=(int(total_seconds)))\n                )\n              )\n", "path": "install_files/ansible-base/callback_plugins/profile_tasks.py"}], "after_files": [{"content": null, "path": "install_files/ansible-base/callback_plugins/profile_tasks.py"}]}