prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Scheduler only hosts on unix socket when run in the background
  Support for hosting the central scheduler on a unix socket was added, which is nice, but the scheduler ignores the `--unix-socket` argument from the command line when `--background` is not also supplied.  
  
  This will work properly, and the scheduler will listen on the provided unix socket:
  
  ```
  luigid --unix-socket /path/to/socket --background
  ```
  
  With this command, the scheduler will still listen on the default port (8082):
  
  ```
  luigid --unix-socket /path/to/socket
  ```
  
  Fixing this would be a simple matter of passing the `unix_socket` argument onto the call to `server.run` in the case where the server is not daemonized, but was there a reason this functionality was left out in the first place?  If so, it probably ought to be in the documentation; as is, reading it gives me the impression that I should be able to tell the scheduler to listen on a unix socket regardless of whether it's running in the background.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `luigi/cmdline.py`
  Content:
  ```
  1 import os
  2 import argparse
  3 import logging
  4 import sys
  5 
  6 from luigi.retcodes import run_with_retcodes
  7 
  8 
  9 def luigi_run(argv=sys.argv[1:]):
  10     run_with_retcodes(argv)
  11 
  12 
  13 def luigid(argv=sys.argv[1:]):
  14     import luigi.server
  15     import luigi.process
  16     import luigi.configuration
  17     parser = argparse.ArgumentParser(description=u'Central luigi server')
  18     parser.add_argument(u'--background', help=u'Run in background mode', action='store_true')
  19     parser.add_argument(u'--pidfile', help=u'Write pidfile')
  20     parser.add_argument(u'--logdir', help=u'log directory')
  21     parser.add_argument(u'--state-path', help=u'Pickled state file')
  22     parser.add_argument(u'--address', help=u'Listening interface')
  23     parser.add_argument(u'--unix-socket', help=u'Unix socket path')
  24     parser.add_argument(u'--port', default=8082, help=u'Listening port')
  25 
  26     opts = parser.parse_args(argv)
  27 
  28     if opts.state_path:
  29         config = luigi.configuration.get_config()
  30         config.set('scheduler', 'state_path', opts.state_path)
  31 
  32     if opts.background:
  33         # daemonize sets up logging to spooled log files
  34         logging.getLogger().setLevel(logging.INFO)
  35         luigi.process.daemonize(luigi.server.run, api_port=opts.port,
  36                                 address=opts.address, pidfile=opts.pidfile,
  37                                 logdir=opts.logdir, unix_socket=opts.unix_socket)
  38     else:
  39         if opts.logdir:
  40             logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format(),
  41                                 filename=os.path.join(opts.logdir, "luigi-server.log"))
  42         else:
  43             logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())
  44         luigi.server.run(api_port=opts.port, address=opts.address)
  45
  ```
  --- 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/luigi/cmdline.py b/luigi/cmdline.py
  --- a/luigi/cmdline.py
  +++ b/luigi/cmdline.py
  @@ -41,4 +41,4 @@
                                   filename=os.path.join(opts.logdir, "luigi-server.log"))
           else:
               logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())
  -        luigi.server.run(api_port=opts.port, address=opts.address)
  +        luigi.server.run(api_port=opts.port, address=opts.address, unix_socket=opts.unix_socket)
  
verification_info: {"golden_diff": "diff --git a/luigi/cmdline.py b/luigi/cmdline.py\n--- a/luigi/cmdline.py\n+++ b/luigi/cmdline.py\n@@ -41,4 +41,4 @@\n                                 filename=os.path.join(opts.logdir, \"luigi-server.log\"))\n         else:\n             logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())\n-        luigi.server.run(api_port=opts.port, address=opts.address)\n+        luigi.server.run(api_port=opts.port, address=opts.address, unix_socket=opts.unix_socket)\n", "issue": "Scheduler only hosts on unix socket when run in the background\nSupport for hosting the central scheduler on a unix socket was added, which is nice, but the scheduler ignores the `--unix-socket` argument from the command line when `--background` is not also supplied.  \n\nThis will work properly, and the scheduler will listen on the provided unix socket:\n\n```\nluigid --unix-socket /path/to/socket --background\n```\n\nWith this command, the scheduler will still listen on the default port (8082):\n\n```\nluigid --unix-socket /path/to/socket\n```\n\nFixing this would be a simple matter of passing the `unix_socket` argument onto the call to `server.run` in the case where the server is not daemonized, but was there a reason this functionality was left out in the first place?  If so, it probably ought to be in the documentation; as is, reading it gives me the impression that I should be able to tell the scheduler to listen on a unix socket regardless of whether it's running in the background.\n\n", "before_files": [{"content": "import os\nimport argparse\nimport logging\nimport sys\n\nfrom luigi.retcodes import run_with_retcodes\n\n\ndef luigi_run(argv=sys.argv[1:]):\n    run_with_retcodes(argv)\n\n\ndef luigid(argv=sys.argv[1:]):\n    import luigi.server\n    import luigi.process\n    import luigi.configuration\n    parser = argparse.ArgumentParser(description=u'Central luigi server')\n    parser.add_argument(u'--background', help=u'Run in background mode', action='store_true')\n    parser.add_argument(u'--pidfile', help=u'Write pidfile')\n    parser.add_argument(u'--logdir', help=u'log directory')\n    parser.add_argument(u'--state-path', help=u'Pickled state file')\n    parser.add_argument(u'--address', help=u'Listening interface')\n    parser.add_argument(u'--unix-socket', help=u'Unix socket path')\n    parser.add_argument(u'--port', default=8082, help=u'Listening port')\n\n    opts = parser.parse_args(argv)\n\n    if opts.state_path:\n        config = luigi.configuration.get_config()\n        config.set('scheduler', 'state_path', opts.state_path)\n\n    if opts.background:\n        # daemonize sets up logging to spooled log files\n        logging.getLogger().setLevel(logging.INFO)\n        luigi.process.daemonize(luigi.server.run, api_port=opts.port,\n                                address=opts.address, pidfile=opts.pidfile,\n                                logdir=opts.logdir, unix_socket=opts.unix_socket)\n    else:\n        if opts.logdir:\n            logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format(),\n                                filename=os.path.join(opts.logdir, \"luigi-server.log\"))\n        else:\n            logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())\n        luigi.server.run(api_port=opts.port, address=opts.address)\n", "path": "luigi/cmdline.py"}], "after_files": [{"content": "import os\nimport argparse\nimport logging\nimport sys\n\nfrom luigi.retcodes import run_with_retcodes\n\n\ndef luigi_run(argv=sys.argv[1:]):\n    run_with_retcodes(argv)\n\n\ndef luigid(argv=sys.argv[1:]):\n    import luigi.server\n    import luigi.process\n    import luigi.configuration\n    parser = argparse.ArgumentParser(description=u'Central luigi server')\n    parser.add_argument(u'--background', help=u'Run in background mode', action='store_true')\n    parser.add_argument(u'--pidfile', help=u'Write pidfile')\n    parser.add_argument(u'--logdir', help=u'log directory')\n    parser.add_argument(u'--state-path', help=u'Pickled state file')\n    parser.add_argument(u'--address', help=u'Listening interface')\n    parser.add_argument(u'--unix-socket', help=u'Unix socket path')\n    parser.add_argument(u'--port', default=8082, help=u'Listening port')\n\n    opts = parser.parse_args(argv)\n\n    if opts.state_path:\n        config = luigi.configuration.get_config()\n        config.set('scheduler', 'state_path', opts.state_path)\n\n    if opts.background:\n        # daemonize sets up logging to spooled log files\n        logging.getLogger().setLevel(logging.INFO)\n        luigi.process.daemonize(luigi.server.run, api_port=opts.port,\n                                address=opts.address, pidfile=opts.pidfile,\n                                logdir=opts.logdir, unix_socket=opts.unix_socket)\n    else:\n        if opts.logdir:\n            logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format(),\n                                filename=os.path.join(opts.logdir, \"luigi-server.log\"))\n        else:\n            logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())\n        luigi.server.run(api_port=opts.port, address=opts.address, unix_socket=opts.unix_socket)\n", "path": "luigi/cmdline.py"}]}