We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add CLI flags for all Fargate Agent keyword arguments
As another interface for setting the various config settings.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 import sys
2 
3 from setuptools import find_packages, setup
4 
5 import versioneer
6 
7 ## base requirements
8 install_requires = open("requirements.txt").read().strip().split("\n")
9 dev_requires = open("dev-requirements.txt").read().strip().split("\n")
10 
11 extras = {
12     "airtable": ["airtable-python-wrapper >= 0.11, < 0.12"],
13     "aws": ["boto3 >= 1.9, < 2.0"],
14     "azure": [
15         "azure-storage-blob >= 2.1.0, < 3.0",
16         "azureml-sdk >= 1.0.65, < 1.1",
17         "azure-cosmos >= 3.1.1, <3.2",
18     ],
19     "dev": dev_requires,
20     "dropbox": ["dropbox ~= 9.0"],
21     "google": [
22         "google-cloud-bigquery >= 1.6.0, < 2.0",
23         "google-cloud-storage >= 1.13, < 2.0",
24     ],
25     "kubernetes": ["kubernetes >= 9.0.0a1, < 10.0", "dask-kubernetes >= 0.8.0"],
26     "rss": ["feedparser >= 5.0.1, < 6.0"],
27     "postgres": ["psycopg2-binary >= 2.8.2"],
28     "snowflake": ["snowflake-connector-python >= 1.8.2, < 2.0"],
29     "redis": ["redis >= 3.2.1"],
30     "spacy": ["spacy >= 2.0.0, < 3.0.0"],
31     "templates": ["jinja2 >= 2.0, < 3.0"],
32     "viz": ["graphviz >= 0.8.3"],
33     "twitter": ["tweepy >= 3.5, < 4.0"],
34 }
35 
36 if sys.version_info < (3, 6):
37     extras["dev"].remove("black")
38 
39 extras["all_extras"] = sum(extras.values(), [])
40 
41 
42 setup(
43     name="prefect",
44     version=versioneer.get_version(),
45     cmdclass=versioneer.get_cmdclass(),
46     install_requires=install_requires,
47     extras_require=extras,
48     scripts=[],
49     packages=find_packages(where="src"),
50     package_dir={"": "src"},
51     include_package_data=True,
52     entry_points={"console_scripts": ["prefect=prefect.cli:cli"]},
53     python_requires=">=3.5.2",
54     description="The Prefect Core automation and scheduling engine.",
55     long_description=open("README.md").read(),
56     long_description_content_type="text/markdown",
57     url="https://www.github.com/PrefectHQ/prefect",
58     license="Apache License 2.0",
59     author="Prefect Technologies, Inc.",
60     author_email="help@prefect.io",
61     classifiers=[
62         "Development Status :: 4 - Beta",
63         "Intended Audience :: Developers",
64         "Intended Audience :: System Administrators",
65         "License :: OSI Approved :: Apache Software License",
66         "Programming Language :: Python :: 3 :: Only",
67         "Programming Language :: Python :: 3.5",
68         "Programming Language :: Python :: 3.6",
69         "Programming Language :: Python :: 3.7",
70         "Topic :: Software Development :: Libraries",
71         "Topic :: System :: Monitoring",
72     ],
73 )
74
```

Path: `src/prefect/cli/agent.py`
Content:
```
1 import click
2 
3 from prefect import config, context
4 from prefect.utilities.configuration import set_temporary_config
5 from prefect.utilities.serialization import from_qualified_name
6 
7 _agents = {
8     "fargate": "prefect.agent.fargate.FargateAgent",
9     "local": "prefect.agent.local.LocalAgent",
10     "kubernetes": "prefect.agent.kubernetes.KubernetesAgent",
11     "nomad": "prefect.agent.nomad.NomadAgent",
12 }
13 
14 
15 @click.group(hidden=True)
16 def agent():
17     """
18     Manage Prefect agents.
19 
20     \b
21     Usage:
22         $ prefect agent [COMMAND]
23 
24     \b
25     Arguments:
26         start       Start a Prefect agent
27         install     Output platform-specific agent installation configs
28 
29     \b
30     Examples:
31         $ prefect agent start
32         ...agent begins running in process...
33 
34     \b
35         $ prefect agent start kubernetes --token MY_TOKEN
36         ...agent begins running in process...
37 
38     \b
39         $ prefect agent install --token MY_TOKEN --namespace metrics
40         ...k8s yaml output...
41     """
42     pass
43 
44 
45 @agent.command(hidden=True)
46 @click.argument("agent-option", default="local")
47 @click.option(
48     "--token", "-t", required=False, help="A Prefect Cloud API token.", hidden=True
49 )
50 @click.option(
51     "--name",
52     "-n",
53     required=False,
54     help="A name to use for the agent",
55     hidden=True,
56     default=None,
57 )
58 @click.option(
59     "--verbose", "-v", is_flag=True, help="Enable verbose agent logs.", hidden=True
60 )
61 @click.option(
62     "--label",
63     "-l",
64     multiple=True,
65     help="Labels the agent will use to query for flow runs.",
66     hidden=True,
67 )
68 @click.option("--no-pull", is_flag=True, help="Pull images flag.", hidden=True)
69 @click.option("--base-url", "-b", help="Docker daemon base URL.", hidden=True)
70 def start(agent_option, token, name, verbose, label, no_pull, base_url):
71     """
72     Start an agent.
73 
74     \b
75     Arguments:
76         agent-option    TEXT    The name of an agent to start (e.g. `local`, `kubernetes`, `fargate`, `nomad`)
77                                 Defaults to `local`
78 
79     \b
80     Options:
81         --token, -t     TEXT    A Prefect Cloud API token with RUNNER scope
82         --name, -n      TEXT    A name to use for the agent
83         --verbose, -v           Enable verbose agent DEBUG logs
84                                 Defaults to INFO level logging
85         --label, -l     TEXT    Labels the agent will use to query for flow runs
86                                 Multiple values supported e.g. `-l label1 -l label2`
87 
88     \b
89     Local Agent Options:
90         --base-url, -b  TEXT    A Docker daemon host URL for a LocalAgent
91         --no-pull               Pull images for a LocalAgent
92                                 Defaults to pulling if not provided
93     """
94     tmp_config = {"cloud.agent.auth_token": token or config.cloud.agent.auth_token}
95     if verbose:
96         tmp_config["cloud.agent.level"] = "DEBUG"
97 
98     with set_temporary_config(tmp_config):
99         retrieved_agent = _agents.get(agent_option, None)
100 
101         if not retrieved_agent:
102             click.secho("{} is not a valid agent".format(agent_option), fg="red")
103             return
104 
105         with context(no_pull=no_pull, base_url=base_url):
106             from_qualified_name(retrieved_agent)(name=name, labels=list(label)).start()
107 
108 
109 @agent.command(hidden=True)
110 @click.argument("name", default="kubernetes")
111 @click.option(
112     "--token", "-t", required=False, help="A Prefect Cloud API token.", hidden=True
113 )
114 @click.option(
115     "--api", "-a", required=False, help="A Prefect Cloud API URL.", hidden=True
116 )
117 @click.option(
118     "--namespace",
119     "-n",
120     required=False,
121     help="Agent namespace to launch workloads.",
122     hidden=True,
123 )
124 @click.option(
125     "--image-pull-secrets",
126     "-i",
127     required=False,
128     help="Name of image pull secrets to use for workloads.",
129     hidden=True,
130 )
131 @click.option(
132     "--resource-manager", is_flag=True, help="Enable resource manager.", hidden=True
133 )
134 @click.option(
135     "--label",
136     "-l",
137     multiple=True,
138     help="Labels the agent will use to query for flow runs.",
139     hidden=True,
140 )
141 def install(name, token, api, namespace, image_pull_secrets, resource_manager, label):
142     """
143     Install an agent. Outputs configuration text which can be used to install on various
144     platforms. The Prefect image version will default to your local `prefect.__version__`
145 
146     \b
147     Arguments:
148         name                        TEXT    The name of an agent to start (e.g. `kubernetes`)
149                                             Defaults to `kubernetes`
150 
151     \b
152     Options:
153         --token, -t                 TEXT    A Prefect Cloud API token
154         --api, -a                   TEXT    A Prefect Cloud API URL
155         --namespace, -n             TEXT    Agent namespace to launch workloads
156         --image-pull-secrets, -i    TEXT    Name of image pull secrets to use for workloads
157         --resource-manager                  Enable resource manager on install
158         --label, -l                 TEXT    Labels the agent will use to query for flow runs
159                                             Multiple values supported e.g. `-l label1 -l label2`
160     """
161 
162     supported_agents = {"kubernetes": "prefect.agent.kubernetes.KubernetesAgent"}
163 
164     retrieved_agent = supported_agents.get(name, None)
165 
166     if not retrieved_agent:
167         click.secho("{} is not a supported agent for `install`".format(name), fg="red")
168         return
169 
170     deployment = from_qualified_name(retrieved_agent).generate_deployment_yaml(
171         token=token,
172         api=api,
173         namespace=namespace,
174         image_pull_secrets=image_pull_secrets,
175         resource_manager_enabled=resource_manager,
176         labels=list(label),
177     )
178     click.echo(deployment)
179
```
--- 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()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@
     "dropbox": ["dropbox ~= 9.0"],
     "google": [
         "google-cloud-bigquery >= 1.6.0, < 2.0",
-        "google-cloud-storage >= 1.13, < 2.0",
+        "google-cloud-storage >= 1.13, < 1.23.0",
     ],
     "kubernetes": ["kubernetes >= 9.0.0a1, < 10.0", "dask-kubernetes >= 0.8.0"],
     "rss": ["feedparser >= 5.0.1, < 6.0"],
diff --git a/src/prefect/cli/agent.py b/src/prefect/cli/agent.py
--- a/src/prefect/cli/agent.py
+++ b/src/prefect/cli/agent.py
@@ -1,6 +1,6 @@
 import click
 
-from prefect import config, context
+from prefect import config
 from prefect.utilities.configuration import set_temporary_config
 from prefect.utilities.serialization import from_qualified_name
 
@@ -42,7 +42,10 @@
     pass
 
 
-@agent.command(hidden=True)
+@agent.command(
+    hidden=True,
+    context_settings=dict(ignore_unknown_options=True, allow_extra_args=True,),
+)
 @click.argument("agent-option", default="local")
 @click.option(
     "--token", "-t", required=False, help="A Prefect Cloud API token.", hidden=True
@@ -67,7 +70,8 @@
 )
 @click.option("--no-pull", is_flag=True, help="Pull images flag.", hidden=True)
 @click.option("--base-url", "-b", help="Docker daemon base URL.", hidden=True)
-def start(agent_option, token, name, verbose, label, no_pull, base_url):
+@click.pass_context
+def start(ctx, agent_option, token, name, verbose, label, no_pull, base_url):
     """
     Start an agent.
 
@@ -90,7 +94,19 @@
         --base-url, -b  TEXT    A Docker daemon host URL for a LocalAgent
         --no-pull               Pull images for a LocalAgent
                                 Defaults to pulling if not provided
+
+    \b
+    Fargate Agent Options:
+        Any of the configuration options outlined in the docs can be provided here
+        https://docs.prefect.io/cloud/agent/fargate.html#configuration
     """
+
+    # Split context
+    kwargs = dict()
+    for item in ctx.args:
+        item = item.replace("--", "")
+        kwargs.update([item.split("=")])
+
     tmp_config = {"cloud.agent.auth_token": token or config.cloud.agent.auth_token}
     if verbose:
         tmp_config["cloud.agent.level"] = "DEBUG"
@@ -102,7 +118,17 @@
             click.secho("{} is not a valid agent".format(agent_option), fg="red")
             return
 
-        with context(no_pull=no_pull, base_url=base_url):
+        _agent = from_qualified_name(retrieved_agent)
+
+        if agent_option == "local":
+            from_qualified_name(retrieved_agent)(
+                name=name, labels=list(label), base_url=base_url, no_pull=no_pull,
+            ).start()
+        elif agent_option == "fargate":
+            from_qualified_name(retrieved_agent)(
+                name=name, labels=list(label), **kwargs
+            ).start()
+        else:
             from_qualified_name(retrieved_agent)(name=name, labels=list(label)).start()

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -20,7 +20,7 @@\n     \"dropbox\": [\"dropbox ~= 9.0\"],\n     \"google\": [\n         \"google-cloud-bigquery >= 1.6.0, < 2.0\",\n-        \"google-cloud-storage >= 1.13, < 2.0\",\n+        \"google-cloud-storage >= 1.13, < 1.23.0\",\n     ],\n     \"kubernetes\": [\"kubernetes >= 9.0.0a1, < 10.0\", \"dask-kubernetes >= 0.8.0\"],\n     \"rss\": [\"feedparser >= 5.0.1, < 6.0\"],\ndiff --git a/src/prefect/cli/agent.py b/src/prefect/cli/agent.py\n--- a/src/prefect/cli/agent.py\n+++ b/src/prefect/cli/agent.py\n@@ -1,6 +1,6 @@\n import click\n \n-from prefect import config, context\n+from prefect import config\n from prefect.utilities.configuration import set_temporary_config\n from prefect.utilities.serialization import from_qualified_name\n \n@@ -42,7 +42,10 @@\n     pass\n \n \n-@agent.command(hidden=True)\n+@agent.command(\n+    hidden=True,\n+    context_settings=dict(ignore_unknown_options=True, allow_extra_args=True,),\n+)\n @click.argument(\"agent-option\", default=\"local\")\n @click.option(\n     \"--token\", \"-t\", required=False, help=\"A Prefect Cloud API token.\", hidden=True\n@@ -67,7 +70,8 @@\n )\n @click.option(\"--no-pull\", is_flag=True, help=\"Pull images flag.\", hidden=True)\n @click.option(\"--base-url\", \"-b\", help=\"Docker daemon base URL.\", hidden=True)\n-def start(agent_option, token, name, verbose, label, no_pull, base_url):\n+@click.pass_context\n+def start(ctx, agent_option, token, name, verbose, label, no_pull, base_url):\n     \"\"\"\n     Start an agent.\n \n@@ -90,7 +94,19 @@\n         --base-url, -b  TEXT    A Docker daemon host URL for a LocalAgent\n         --no-pull               Pull images for a LocalAgent\n                                 Defaults to pulling if not provided\n+\n+    \\b\n+    Fargate Agent Options:\n+        Any of the configuration options outlined in the docs can be provided here\n+        https://docs.prefect.io/cloud/agent/fargate.html#configuration\n     \"\"\"\n+\n+    # Split context\n+    kwargs = dict()\n+    for item in ctx.args:\n+        item = item.replace(\"--\", \"\")\n+        kwargs.update([item.split(\"=\")])\n+\n     tmp_config = {\"cloud.agent.auth_token\": token or config.cloud.agent.auth_token}\n     if verbose:\n         tmp_config[\"cloud.agent.level\"] = \"DEBUG\"\n@@ -102,7 +118,17 @@\n             click.secho(\"{} is not a valid agent\".format(agent_option), fg=\"red\")\n             return\n \n-        with context(no_pull=no_pull, base_url=base_url):\n+        _agent = from_qualified_name(retrieved_agent)\n+\n+        if agent_option == \"local\":\n+            from_qualified_name(retrieved_agent)(\n+                name=name, labels=list(label), base_url=base_url, no_pull=no_pull,\n+            ).start()\n+        elif agent_option == \"fargate\":\n+            from_qualified_name(retrieved_agent)(\n+                name=name, labels=list(label), **kwargs\n+            ).start()\n+        else:\n             from_qualified_name(retrieved_agent)(name=name, labels=list(label)).start()\n", "issue": "Add CLI flags for all Fargate Agent keyword arguments\nAs another interface for setting the various config settings.\n", "before_files": [{"content": "import sys\n\nfrom setuptools import find_packages, setup\n\nimport versioneer\n\n## base requirements\ninstall_requires = open(\"requirements.txt\").read().strip().split(\"\\n\")\ndev_requires = open(\"dev-requirements.txt\").read().strip().split(\"\\n\")\n\nextras = {\n    \"airtable\": [\"airtable-python-wrapper >= 0.11, < 0.12\"],\n    \"aws\": [\"boto3 >= 1.9, < 2.0\"],\n    \"azure\": [\n        \"azure-storage-blob >= 2.1.0, < 3.0\",\n        \"azureml-sdk >= 1.0.65, < 1.1\",\n        \"azure-cosmos >= 3.1.1, <3.2\",\n    ],\n    \"dev\": dev_requires,\n    \"dropbox\": [\"dropbox ~= 9.0\"],\n    \"google\": [\n        \"google-cloud-bigquery >= 1.6.0, < 2.0\",\n        \"google-cloud-storage >= 1.13, < 2.0\",\n    ],\n    \"kubernetes\": [\"kubernetes >= 9.0.0a1, < 10.0\", \"dask-kubernetes >= 0.8.0\"],\n    \"rss\": [\"feedparser >= 5.0.1, < 6.0\"],\n    \"postgres\": [\"psycopg2-binary >= 2.8.2\"],\n    \"snowflake\": [\"snowflake-connector-python >= 1.8.2, < 2.0\"],\n    \"redis\": [\"redis >= 3.2.1\"],\n    \"spacy\": [\"spacy >= 2.0.0, < 3.0.0\"],\n    \"templates\": [\"jinja2 >= 2.0, < 3.0\"],\n    \"viz\": [\"graphviz >= 0.8.3\"],\n    \"twitter\": [\"tweepy >= 3.5, < 4.0\"],\n}\n\nif sys.version_info < (3, 6):\n    extras[\"dev\"].remove(\"black\")\n\nextras[\"all_extras\"] = sum(extras.values(), [])\n\n\nsetup(\n    name=\"prefect\",\n    version=versioneer.get_version(),\n    cmdclass=versioneer.get_cmdclass(),\n    install_requires=install_requires,\n    extras_require=extras,\n    scripts=[],\n    packages=find_packages(where=\"src\"),\n    package_dir={\"\": \"src\"},\n    include_package_data=True,\n    entry_points={\"console_scripts\": [\"prefect=prefect.cli:cli\"]},\n    python_requires=\">=3.5.2\",\n    description=\"The Prefect Core automation and scheduling engine.\",\n    long_description=open(\"README.md\").read(),\n    long_description_content_type=\"text/markdown\",\n    url=\"https://www.github.com/PrefectHQ/prefect\",\n    license=\"Apache License 2.0\",\n    author=\"Prefect Technologies, Inc.\",\n    author_email=\"help@prefect.io\",\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: System Administrators\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Topic :: Software Development :: Libraries\",\n        \"Topic :: System :: Monitoring\",\n    ],\n)\n", "path": "setup.py"}, {"content": "import click\n\nfrom prefect import config, context\nfrom prefect.utilities.configuration import set_temporary_config\nfrom prefect.utilities.serialization import from_qualified_name\n\n_agents = {\n    \"fargate\": \"prefect.agent.fargate.FargateAgent\",\n    \"local\": \"prefect.agent.local.LocalAgent\",\n    \"kubernetes\": \"prefect.agent.kubernetes.KubernetesAgent\",\n    \"nomad\": \"prefect.agent.nomad.NomadAgent\",\n}\n\n\n@click.group(hidden=True)\ndef agent():\n    \"\"\"\n    Manage Prefect agents.\n\n    \\b\n    Usage:\n        $ prefect agent [COMMAND]\n\n    \\b\n    Arguments:\n        start       Start a Prefect agent\n        install     Output platform-specific agent installation configs\n\n    \\b\n    Examples:\n        $ prefect agent start\n        ...agent begins running in process...\n\n    \\b\n        $ prefect agent start kubernetes --token MY_TOKEN\n        ...agent begins running in process...\n\n    \\b\n        $ prefect agent install --token MY_TOKEN --namespace metrics\n        ...k8s yaml output...\n    \"\"\"\n    pass\n\n\n@agent.command(hidden=True)\n@click.argument(\"agent-option\", default=\"local\")\n@click.option(\n    \"--token\", \"-t\", required=False, help=\"A Prefect Cloud API token.\", hidden=True\n)\n@click.option(\n    \"--name\",\n    \"-n\",\n    required=False,\n    help=\"A name to use for the agent\",\n    hidden=True,\n    default=None,\n)\n@click.option(\n    \"--verbose\", \"-v\", is_flag=True, help=\"Enable verbose agent logs.\", hidden=True\n)\n@click.option(\n    \"--label\",\n    \"-l\",\n    multiple=True,\n    help=\"Labels the agent will use to query for flow runs.\",\n    hidden=True,\n)\n@click.option(\"--no-pull\", is_flag=True, help=\"Pull images flag.\", hidden=True)\n@click.option(\"--base-url\", \"-b\", help=\"Docker daemon base URL.\", hidden=True)\ndef start(agent_option, token, name, verbose, label, no_pull, base_url):\n    \"\"\"\n    Start an agent.\n\n    \\b\n    Arguments:\n        agent-option    TEXT    The name of an agent to start (e.g. `local`, `kubernetes`, `fargate`, `nomad`)\n                                Defaults to `local`\n\n    \\b\n    Options:\n        --token, -t     TEXT    A Prefect Cloud API token with RUNNER scope\n        --name, -n      TEXT    A name to use for the agent\n        --verbose, -v           Enable verbose agent DEBUG logs\n                                Defaults to INFO level logging\n        --label, -l     TEXT    Labels the agent will use to query for flow runs\n                                Multiple values supported e.g. `-l label1 -l label2`\n\n    \\b\n    Local Agent Options:\n        --base-url, -b  TEXT    A Docker daemon host URL for a LocalAgent\n        --no-pull               Pull images for a LocalAgent\n                                Defaults to pulling if not provided\n    \"\"\"\n    tmp_config = {\"cloud.agent.auth_token\": token or config.cloud.agent.auth_token}\n    if verbose:\n        tmp_config[\"cloud.agent.level\"] = \"DEBUG\"\n\n    with set_temporary_config(tmp_config):\n        retrieved_agent = _agents.get(agent_option, None)\n\n        if not retrieved_agent:\n            click.secho(\"{} is not a valid agent\".format(agent_option), fg=\"red\")\n            return\n\n        with context(no_pull=no_pull, base_url=base_url):\n            from_qualified_name(retrieved_agent)(name=name, labels=list(label)).start()\n\n\n@agent.command(hidden=True)\n@click.argument(\"name\", default=\"kubernetes\")\n@click.option(\n    \"--token\", \"-t\", required=False, help=\"A Prefect Cloud API token.\", hidden=True\n)\n@click.option(\n    \"--api\", \"-a\", required=False, help=\"A Prefect Cloud API URL.\", hidden=True\n)\n@click.option(\n    \"--namespace\",\n    \"-n\",\n    required=False,\n    help=\"Agent namespace to launch workloads.\",\n    hidden=True,\n)\n@click.option(\n    \"--image-pull-secrets\",\n    \"-i\",\n    required=False,\n    help=\"Name of image pull secrets to use for workloads.\",\n    hidden=True,\n)\n@click.option(\n    \"--resource-manager\", is_flag=True, help=\"Enable resource manager.\", hidden=True\n)\n@click.option(\n    \"--label\",\n    \"-l\",\n    multiple=True,\n    help=\"Labels the agent will use to query for flow runs.\",\n    hidden=True,\n)\ndef install(name, token, api, namespace, image_pull_secrets, resource_manager, label):\n    \"\"\"\n    Install an agent. Outputs configuration text which can be used to install on various\n    platforms. The Prefect image version will default to your local `prefect.__version__`\n\n    \\b\n    Arguments:\n        name                        TEXT    The name of an agent to start (e.g. `kubernetes`)\n                                            Defaults to `kubernetes`\n\n    \\b\n    Options:\n        --token, -t                 TEXT    A Prefect Cloud API token\n        --api, -a                   TEXT    A Prefect Cloud API URL\n        --namespace, -n             TEXT    Agent namespace to launch workloads\n        --image-pull-secrets, -i    TEXT    Name of image pull secrets to use for workloads\n        --resource-manager                  Enable resource manager on install\n        --label, -l                 TEXT    Labels the agent will use to query for flow runs\n                                            Multiple values supported e.g. `-l label1 -l label2`\n    \"\"\"\n\n    supported_agents = {\"kubernetes\": \"prefect.agent.kubernetes.KubernetesAgent\"}\n\n    retrieved_agent = supported_agents.get(name, None)\n\n    if not retrieved_agent:\n        click.secho(\"{} is not a supported agent for `install`\".format(name), fg=\"red\")\n        return\n\n    deployment = from_qualified_name(retrieved_agent).generate_deployment_yaml(\n        token=token,\n        api=api,\n        namespace=namespace,\n        image_pull_secrets=image_pull_secrets,\n        resource_manager_enabled=resource_manager,\n        labels=list(label),\n    )\n    click.echo(deployment)\n", "path": "src/prefect/cli/agent.py"}], "after_files": [{"content": "import sys\n\nfrom setuptools import find_packages, setup\n\nimport versioneer\n\n## base requirements\ninstall_requires = open(\"requirements.txt\").read().strip().split(\"\\n\")\ndev_requires = open(\"dev-requirements.txt\").read().strip().split(\"\\n\")\n\nextras = {\n    \"airtable\": [\"airtable-python-wrapper >= 0.11, < 0.12\"],\n    \"aws\": [\"boto3 >= 1.9, < 2.0\"],\n    \"azure\": [\n        \"azure-storage-blob >= 2.1.0, < 3.0\",\n        \"azureml-sdk >= 1.0.65, < 1.1\",\n        \"azure-cosmos >= 3.1.1, <3.2\",\n    ],\n    \"dev\": dev_requires,\n    \"dropbox\": [\"dropbox ~= 9.0\"],\n    \"google\": [\n        \"google-cloud-bigquery >= 1.6.0, < 2.0\",\n        \"google-cloud-storage >= 1.13, < 1.23.0\",\n    ],\n    \"kubernetes\": [\"kubernetes >= 9.0.0a1, < 10.0\", \"dask-kubernetes >= 0.8.0\"],\n    \"rss\": [\"feedparser >= 5.0.1, < 6.0\"],\n    \"postgres\": [\"psycopg2-binary >= 2.8.2\"],\n    \"snowflake\": [\"snowflake-connector-python >= 1.8.2, < 2.0\"],\n    \"redis\": [\"redis >= 3.2.1\"],\n    \"spacy\": [\"spacy >= 2.0.0, < 3.0.0\"],\n    \"templates\": [\"jinja2 >= 2.0, < 3.0\"],\n    \"viz\": [\"graphviz >= 0.8.3\"],\n    \"twitter\": [\"tweepy >= 3.5, < 4.0\"],\n}\n\nif sys.version_info < (3, 6):\n    extras[\"dev\"].remove(\"black\")\n\nextras[\"all_extras\"] = sum(extras.values(), [])\n\n\nsetup(\n    name=\"prefect\",\n    version=versioneer.get_version(),\n    cmdclass=versioneer.get_cmdclass(),\n    install_requires=install_requires,\n    extras_require=extras,\n    scripts=[],\n    packages=find_packages(where=\"src\"),\n    package_dir={\"\": \"src\"},\n    include_package_data=True,\n    entry_points={\"console_scripts\": [\"prefect=prefect.cli:cli\"]},\n    python_requires=\">=3.5.2\",\n    description=\"The Prefect Core automation and scheduling engine.\",\n    long_description=open(\"README.md\").read(),\n    long_description_content_type=\"text/markdown\",\n    url=\"https://www.github.com/PrefectHQ/prefect\",\n    license=\"Apache License 2.0\",\n    author=\"Prefect Technologies, Inc.\",\n    author_email=\"help@prefect.io\",\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: System Administrators\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Topic :: Software Development :: Libraries\",\n        \"Topic :: System :: Monitoring\",\n    ],\n)\n", "path": "setup.py"}, {"content": "import click\n\nfrom prefect import config\nfrom prefect.utilities.configuration import set_temporary_config\nfrom prefect.utilities.serialization import from_qualified_name\n\n_agents = {\n    \"fargate\": \"prefect.agent.fargate.FargateAgent\",\n    \"local\": \"prefect.agent.local.LocalAgent\",\n    \"kubernetes\": \"prefect.agent.kubernetes.KubernetesAgent\",\n    \"nomad\": \"prefect.agent.nomad.NomadAgent\",\n}\n\n\n@click.group(hidden=True)\ndef agent():\n    \"\"\"\n    Manage Prefect agents.\n\n    \\b\n    Usage:\n        $ prefect agent [COMMAND]\n\n    \\b\n    Arguments:\n        start       Start a Prefect agent\n        install     Output platform-specific agent installation configs\n\n    \\b\n    Examples:\n        $ prefect agent start\n        ...agent begins running in process...\n\n    \\b\n        $ prefect agent start kubernetes --token MY_TOKEN\n        ...agent begins running in process...\n\n    \\b\n        $ prefect agent install --token MY_TOKEN --namespace metrics\n        ...k8s yaml output...\n    \"\"\"\n    pass\n\n\n@agent.command(\n    hidden=True,\n    context_settings=dict(ignore_unknown_options=True, allow_extra_args=True,),\n)\n@click.argument(\"agent-option\", default=\"local\")\n@click.option(\n    \"--token\", \"-t\", required=False, help=\"A Prefect Cloud API token.\", hidden=True\n)\n@click.option(\n    \"--name\",\n    \"-n\",\n    required=False,\n    help=\"A name to use for the agent\",\n    hidden=True,\n    default=None,\n)\n@click.option(\n    \"--verbose\", \"-v\", is_flag=True, help=\"Enable verbose agent logs.\", hidden=True\n)\n@click.option(\n    \"--label\",\n    \"-l\",\n    multiple=True,\n    help=\"Labels the agent will use to query for flow runs.\",\n    hidden=True,\n)\n@click.option(\"--no-pull\", is_flag=True, help=\"Pull images flag.\", hidden=True)\n@click.option(\"--base-url\", \"-b\", help=\"Docker daemon base URL.\", hidden=True)\n@click.pass_context\ndef start(ctx, agent_option, token, name, verbose, label, no_pull, base_url):\n    \"\"\"\n    Start an agent.\n\n    \\b\n    Arguments:\n        agent-option    TEXT    The name of an agent to start (e.g. `local`, `kubernetes`, `fargate`, `nomad`)\n                                Defaults to `local`\n\n    \\b\n    Options:\n        --token, -t     TEXT    A Prefect Cloud API token with RUNNER scope\n        --name, -n      TEXT    A name to use for the agent\n        --verbose, -v           Enable verbose agent DEBUG logs\n                                Defaults to INFO level logging\n        --label, -l     TEXT    Labels the agent will use to query for flow runs\n                                Multiple values supported e.g. `-l label1 -l label2`\n\n    \\b\n    Local Agent Options:\n        --base-url, -b  TEXT    A Docker daemon host URL for a LocalAgent\n        --no-pull               Pull images for a LocalAgent\n                                Defaults to pulling if not provided\n\n    \\b\n    Fargate Agent Options:\n        Any of the configuration options outlined in the docs can be provided here\n        https://docs.prefect.io/cloud/agent/fargate.html#configuration\n    \"\"\"\n\n    # Split context\n    kwargs = dict()\n    for item in ctx.args:\n        item = item.replace(\"--\", \"\")\n        kwargs.update([item.split(\"=\")])\n\n    tmp_config = {\"cloud.agent.auth_token\": token or config.cloud.agent.auth_token}\n    if verbose:\n        tmp_config[\"cloud.agent.level\"] = \"DEBUG\"\n\n    with set_temporary_config(tmp_config):\n        retrieved_agent = _agents.get(agent_option, None)\n\n        if not retrieved_agent:\n            click.secho(\"{} is not a valid agent\".format(agent_option), fg=\"red\")\n            return\n\n        _agent = from_qualified_name(retrieved_agent)\n\n        if agent_option == \"local\":\n            from_qualified_name(retrieved_agent)(\n                name=name, labels=list(label), base_url=base_url, no_pull=no_pull,\n            ).start()\n        elif agent_option == \"fargate\":\n            from_qualified_name(retrieved_agent)(\n                name=name, labels=list(label), **kwargs\n            ).start()\n        else:\n            from_qualified_name(retrieved_agent)(name=name, labels=list(label)).start()\n\n\n@agent.command(hidden=True)\n@click.argument(\"name\", default=\"kubernetes\")\n@click.option(\n    \"--token\", \"-t\", required=False, help=\"A Prefect Cloud API token.\", hidden=True\n)\n@click.option(\n    \"--api\", \"-a\", required=False, help=\"A Prefect Cloud API URL.\", hidden=True\n)\n@click.option(\n    \"--namespace\",\n    \"-n\",\n    required=False,\n    help=\"Agent namespace to launch workloads.\",\n    hidden=True,\n)\n@click.option(\n    \"--image-pull-secrets\",\n    \"-i\",\n    required=False,\n    help=\"Name of image pull secrets to use for workloads.\",\n    hidden=True,\n)\n@click.option(\n    \"--resource-manager\", is_flag=True, help=\"Enable resource manager.\", hidden=True\n)\n@click.option(\n    \"--label\",\n    \"-l\",\n    multiple=True,\n    help=\"Labels the agent will use to query for flow runs.\",\n    hidden=True,\n)\ndef install(name, token, api, namespace, image_pull_secrets, resource_manager, label):\n    \"\"\"\n    Install an agent. Outputs configuration text which can be used to install on various\n    platforms. The Prefect image version will default to your local `prefect.__version__`\n\n    \\b\n    Arguments:\n        name                        TEXT    The name of an agent to start (e.g. `kubernetes`)\n                                            Defaults to `kubernetes`\n\n    \\b\n    Options:\n        --token, -t                 TEXT    A Prefect Cloud API token\n        --api, -a                   TEXT    A Prefect Cloud API URL\n        --namespace, -n             TEXT    Agent namespace to launch workloads\n        --image-pull-secrets, -i    TEXT    Name of image pull secrets to use for workloads\n        --resource-manager                  Enable resource manager on install\n        --label, -l                 TEXT    Labels the agent will use to query for flow runs\n                                            Multiple values supported e.g. `-l label1 -l label2`\n    \"\"\"\n\n    supported_agents = {\"kubernetes\": \"prefect.agent.kubernetes.KubernetesAgent\"}\n\n    retrieved_agent = supported_agents.get(name, None)\n\n    if not retrieved_agent:\n        click.secho(\"{} is not a supported agent for `install`\".format(name), fg=\"red\")\n        return\n\n    deployment = from_qualified_name(retrieved_agent).generate_deployment_yaml(\n        token=token,\n        api=api,\n        namespace=namespace,\n        image_pull_secrets=image_pull_secrets,\n        resource_manager_enabled=resource_manager,\n        labels=list(label),\n    )\n    click.echo(deployment)\n", "path": "src/prefect/cli/agent.py"}]}