internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: PrefectHQ/prefect

Issue:
Fix documentation for parameters for the DockerContainer infrastructure
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

https://docs.prefect.io/api-ref/prefect/infrastructure/#prefect.infrastructure.docker.DockerContainer

> "If set, the container will be removed on completion. Otherwise,"

and there the sentence ends for the `auto_remove` parameter. When I click on the pencil Icon I am redirected to this page, which does not exist (error 404): https://github.com/PrefectHQ/prefect/edit/master/docs/api-ref/prefect/infrastructure.md


Additionally, it would be nice to see the default arguments in the documentation.

### Reproduction

```python
/
```


### Error

_No response_

### Versions

2.0.4

### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/src/prefect/infrastructure/docker.py b/src/prefect/infrastructure/docker.py
--- a/src/prefect/infrastructure/docker.py
+++ b/src/prefect/infrastructure/docker.py
@@ -139,6 +139,7 @@ class DockerContainer(Infrastructure):
 
     Attributes:
         auto_remove: If set, the container will be removed on completion. Otherwise,
+            the container will remain after exit for inspection.
         command: A list of strings specifying the command to run in the container to
             start the flow run. In most cases you should not override this.
         env: Environment variables to set for the container.
@@ -153,7 +154,6 @@ class DockerContainer(Infrastructure):
             used. If 'networks' is set, this cannot be set.
         networks: An optional list of strings specifying Docker networks to connect the
             container to.
-            the container will remain after exit for inspection.
         stream_output: If set, stream output from the container to local standard output.
         volumes: An optional list of volume mount strings in the format of
             "local_path:container_path".


Test patch:
Repository: PrefectHQ/prefect

Issue:
Typo on flow-run command
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

Found a typo while using the prefect cli tool for flow-runs command.
https://github.com/PrefectHQ/prefect/blob/42e5a978390575b8bd6ef4c258ba703f7e28fca2/src/prefect/cli/flow_run.py#L126

<img width="686" alt="Screenshot 2023-03-08 at 15 17 55" src="https://user-images.githubusercontent.com/1419169/223752883-09908c42-776c-4c51-9864-5300d788de5c.png">

I think it should have been `run` instead of `fun` 😸 

### Reproduction

```python3
prefect flow-runs --help
```


### Error

_No response_

### Versions

```Text
Prefect version: 2.8.4
Python version: 3.11.2
```


### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/src/prefect/cli/flow_run.py b/src/prefect/cli/flow_run.py
--- a/src/prefect/cli/flow_run.py
+++ b/src/prefect/cli/flow_run.py
@@ -123,7 +123,7 @@ async def delete(id: UUID):
 
 @flow_run_app.command()
 async def cancel(id: UUID):
-    """Cancel a flow fun by ID."""
+    """Cancel a flow run by ID."""
     async with get_client() as client:
         cancelling_state = State(type=StateType.CANCELLING)
         try:


Test patch:
Repository: PrefectHQ/prefect

Issue:
Set runs created with `/deployments/<deployment_id>/create_flow_run` to a SCHEDULED state with a start time of now by default
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar request and didn't find it.
- [X] I searched the Prefect documentation for this feature.

### Prefect Version

2.x

### Describe the current behavior

Currently, unless otherwise specified, runs created directly via the `https://my-prefect-dns/api/deployments/<deployment_id>/create_flow_run` endpoint are in a PENDING state instead of a SCHEDULED state.

### Describe the proposed behavior

Users typically expect these runs to start immediately. Runs created this way should be in a SCHEDULED state with an immediate start time.

### Example Use

curl -X 'POST' \
  'https://my-prefect-dns/api/deployments/<deployment-id>/create_flow_run' \


### Additional context

See these community conversations:
- https://prefect-community.slack.com/archives/CM28LL405/p1680112687639159
- https://prefect-community.slack.com/archives/CL09KU1K7/p1680121475686169


Discussion:

Resolving patch:
diff --git a/src/prefect/server/api/deployments.py b/src/prefect/server/api/deployments.py
--- a/src/prefect/server/api/deployments.py
+++ b/src/prefect/server/api/deployments.py
@@ -391,7 +391,7 @@ async def create_flow_run_from_deployment(
     Any parameters not provided will be inferred from the deployment's parameters.
     If tags are not provided, the deployment's tags will be used.
 
-    If no state is provided, the flow run will be created in a PENDING state.
+    If no state is provided, the flow run will be created in a SCHEDULED state.
     """
     async with db.session_context(begin_transaction=True) as session:
         # get relevant info from the deployment
@@ -429,7 +429,7 @@ async def create_flow_run_from_deployment(
         )
 
         if not flow_run.state:
-            flow_run.state = schemas.states.Pending()
+            flow_run.state = schemas.states.Scheduled()
 
         now = pendulum.now("UTC")
         model = await models.flow_runs.create_flow_run(


Test patch:
diff --git a/tests/server/api/test_deployments.py b/tests/server/api/test_deployments.py
--- a/tests/server/api/test_deployments.py
+++ b/tests/server/api/test_deployments.py
@@ -1226,6 +1226,7 @@ async def test_create_flow_run_from_deployment_with_defaults(
             deployment.infrastructure_document_id
         )
         assert response.json()["work_queue_name"] == deployment.work_queue_name
+        assert response.json()["state_type"] == schemas.states.StateType.SCHEDULED
 
     async def test_create_flow_run_from_deployment_uses_work_queue_name(
         self, deployment, client, session
Repository: PrefectHQ/prefect

Issue:
Write Workers Concept Doc
Document how to use workers in conjunction with work pools.


Discussion:

Resolving patch:
diff --git a/src/prefect/cli/worker.py b/src/prefect/cli/worker.py
--- a/src/prefect/cli/worker.py
+++ b/src/prefect/cli/worker.py
@@ -27,16 +27,25 @@
 @worker_app.command()
 async def start(
     worker_name: str = typer.Option(
-        None, "-n", "--name", help="The name to give to the started worker."
+        None,
+        "-n",
+        "--name",
+        help=(
+            "The name to give to the started worker. If not provided, a unique name"
+            " will be generated."
+        ),
     ),
     work_pool_name: str = typer.Option(
-        ..., "-p", "--pool", help="The work pool the started worker should join."
+        ..., "-p", "--pool", help="The work pool the started worker should poll."
     ),
     work_queues: List[str] = typer.Option(
         None,
-        "-q",
-        "--work-queue",
-        help="One or more work queue names for the worker to poll.",
+        "-t",
+        "--type",
+        help=(
+            "The type of worker to start. If not provided, the worker type will be"
+            " inferred from the work pool."
+        ),
     ),
     worker_type: Optional[str] = typer.Option(
         None, "-t", "--type", help="The type of worker to start."
@@ -45,7 +54,9 @@ async def start(
         PREFECT_WORKER_PREFETCH_SECONDS,
         help="Number of seconds to look into the future for scheduled flow runs.",
     ),
-    run_once: bool = typer.Option(False, help="Run worker loops only one time."),
+    run_once: bool = typer.Option(
+        False, help="Only run worker polling once. By default, the worker runs forever."
+    ),
     limit: int = typer.Option(
         None,
         "-l",


Test patch:
Repository: PrefectHQ/prefect

Issue:
Filter by work pool not filtering the "dot" graph
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

When filtering by "work pool" in the flows screen, the "dots graph" is not filtered.
The "main-pool" is a pool I've just created, and there are no runs associated to it.


![CleanShot 2023-03-23 at 08 02 45@2x](https://user-images.githubusercontent.com/5398977/227117523-885b8337-37cc-4c87-80a4-f58b8c5e2526.jpg)


### Reproduction

```python3
Create a new "work flow".
Make sure it's empty and has no runs in it.
Go to the flows screen, and filter by this work pool.
You'll see that all the dots on the graph remain although they are not related to that work pool.
```


### Error

_No response_

### Versions

```Text
Prefect cloud
```


### Additional context

_No response_


Discussion:
This issue is stale because it has been open 30 days with no activity. To keep this issue open remove stale label or comment.
Hi,
Bumping this issue.
Would it be possible to take a look?
Maybe I am missing something and it's not an issue at all?
Thanks for bumping @yaronlevi - I've added this to our backlog

Resolving patch:
diff --git a/src/prefect/server/api/ui/flow_runs.py b/src/prefect/server/api/ui/flow_runs.py
--- a/src/prefect/server/api/ui/flow_runs.py
+++ b/src/prefect/server/api/ui/flow_runs.py
@@ -49,6 +49,7 @@ async def read_flow_run_history(
     flow_runs: schemas.filters.FlowRunFilter = None,
     task_runs: schemas.filters.TaskRunFilter = None,
     deployments: schemas.filters.DeploymentFilter = None,
+    work_pools: schemas.filters.WorkPoolFilter = None,
     db: PrefectDBInterface = Depends(provide_database_interface),
 ) -> List[SimpleFlowRun]:
     columns = [
@@ -68,6 +69,7 @@ async def read_flow_run_history(
             flow_run_filter=flow_runs,
             task_run_filter=task_runs,
             deployment_filter=deployments,
+            work_pool_filter=work_pools,
             sort=sort,
             limit=limit,
             offset=offset,


Test patch:
Repository: PrefectHQ/prefect

Issue:
Prefect 2.10.3 introduces write access requirement for deployment creation
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

After upgrading to `2.10.3`, some users have found that their CI pipelines are breaking. The issue appears to be caused by an attempt to write a file during the creation of a deployment via Python. Specifically, the problematic line of code is here: https://github.com/PrefectHQ/prefect/blob/490b7ab55b6667e45ed845c87326c9bb23fbd1c8/src/prefect/deployments.py#L788-L789

In the flow registration step, if the environment doesn't have write access, creating the `.prefectignore` file fails.

### Reproduction

```python3
prefect deployment build path/to/file.py:entrypoint
```


### Error

_No response_

### Versions

```Text
2.10.3
```


### Additional context

A potential solution would be to improve the default handling for cases where the `.prefectignore` file does not exist. Instead of attempting to create the file and causing an error in environments with restricted write access, the code could proceed with a default behavior, such as using an empty ignore list or a pre-defined set of ignore patterns.


Discussion:
Please note that the touch also updates the modification time if the file [exists](https://docs.python.org/3/library/pathlib.html#pathlib.Path.touch). So just placing the .prefectignore in the repo is not a workaround! 
From our perspective this is a breaking change and quite easy to fix in prefect but hard to workaround from our end. If you can point me to a where to add an appropriate test I might even be able to submit a PR myself.

Resolving patch:
diff --git a/src/prefect/deployments.py b/src/prefect/deployments.py
--- a/src/prefect/deployments.py
+++ b/src/prefect/deployments.py
@@ -786,7 +786,8 @@ async def build_from_flow(
         deployment.parameter_openapi_schema = parameter_schema(flow)
 
         # ensure the ignore file exists
-        Path(ignore_file).touch()
+        if not Path(ignore_file).exists():
+            Path(ignore_file).touch()
 
         if not deployment.version:
             deployment.version = flow.version


Test patch:
Repository: PrefectHQ/prefect

Issue:
Sort task run IDs before output, from `prefect concurrency-limit inspect ...`
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar request and didn't find it.
- [X] I searched the Prefect documentation for this feature.

### Prefect Version

2.x

### Describe the current behavior

`prefect concurrency-limit inspect [limit name]` will output a list of "Active Task Run IDs" for tasks which are currently using any of the "concurrency slots". These are UUIDs.

The list currently appears in a random order. This makes it hard to identify whether or not the list of task IDs is changing, and whether any tasks might be in a hung state.

### Describe the proposed behavior

Sort the list of task IDs alphabetically before outputting them.

### Example Use

_No response_

### Additional context

_No response_


Discussion:
@digitalronin I would like to work on this issue. Can you please give some details and assign this to me?
@zmwaris1 they are not a maintainer of this repository. You're welcome to work on this though. It's in the `src/prefect/cli/concurrency_limit.py` file at `inspect`. Probably adding sorting on this line https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/concurrency_limit.py#L85
@madkinsz Thanks for the info. I will start working on it right away.

Resolving patch:
diff --git a/src/prefect/cli/concurrency_limit.py b/src/prefect/cli/concurrency_limit.py
--- a/src/prefect/cli/concurrency_limit.py
+++ b/src/prefect/cli/concurrency_limit.py
@@ -82,7 +82,7 @@ async def inspect(tag: str):
     cl_table.add_column("Created", style="magenta", no_wrap=True)
     cl_table.add_column("Updated", style="magenta", no_wrap=True)
 
-    for trid in result.active_slots:
+    for trid in sorted(result.active_slots):
         trid_table.add_row(str(trid))
 
     cl_table.add_row(


Test patch:
Repository: PrefectHQ/prefect

Issue:
PrefectHTTPStatusError: Client error '429 Too Many Requests' for url
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

While using `prefect` with `prefect-dask` I encountered a rate limit error. this shouldn't be happening as prefect client base should retry on those. I'm not sure why this is happening but this has risen at `2.10.10` and did not exist before

### Reproduction

```python3
Any Flow with prefect-dask
```


### Error

```python3
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/distributed/client.py", line 1697, in _close
    await self.scheduler_comm.close()
asyncio.exceptions.CancelledError
01:00:08.452 | ERROR   | Flow run 'psi5-alastria-x' - Crash detected! Execution was interrupted by an unexpected exception: PrefectHTTPStatusError: Client error '429 Too Many Requests' for url 'https://cloud-url/task_runs/'
Response: {'detail': 'Orchestration API rate limit reached'}
For more information check: https://httpstatuses.com/429
```


### Versions

```Text
Version:             2.10.10
API version:         0.8.4
Python version:      3.11.2
Git commit:          8159450b
Built:               Thu, May 18, 2023 3:43 PM
OS/Arch:             linux/x86_64
Profile:             default
Server type:         server
```


### Additional context

_No response_


Discussion:
For some reason, prefect cloud is not using Prefect base [client ](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/client/base.py#L153)?

https://github.com/PrefectHQ/prefect/blob/main/src/prefect/client/cloud.py#L59

Resolving patch:
diff --git a/src/prefect/client/cloud.py b/src/prefect/client/cloud.py
--- a/src/prefect/client/cloud.py
+++ b/src/prefect/client/cloud.py
@@ -8,6 +8,7 @@
 
 import prefect.context
 import prefect.settings
+from prefect.client.base import PrefectHttpxClient
 from prefect.client.schemas import Workspace
 from prefect.exceptions import PrefectException
 from prefect.settings import PREFECT_API_KEY, PREFECT_CLOUD_API_URL
@@ -56,7 +57,7 @@ def __init__(
         httpx_settings["headers"].setdefault("Authorization", f"Bearer {api_key}")
 
         httpx_settings.setdefault("base_url", host)
-        self._client = httpx.AsyncClient(**httpx_settings)
+        self._client = PrefectHttpxClient(**httpx_settings)
 
     async def api_healthcheck(self):
         """


Test patch:
Repository: PrefectHQ/prefect

Issue:
Add code block to blocks core load function doc string.
### First check

- [X] I added a descriptive title to this issue.
- [X] I used GitHub search to find a similar request and didn't find it 😇

### Describe the issue

Function `load` in blocks.core has MD formatting issues, making the one of the examples not be in code blocks.

### Describe the proposed change

Add an additional code block

### Additional context

_No response_


Discussion:
Thanks for the issue @jeanluciano! Can you share a link to the page where you're seeing the incorrect formatting?
https://docs.prefect.io/2.10.17/api-ref/prefect/blocks/core/#prefect.blocks.core.Block.load

Resolving patch:
diff --git a/src/prefect/blocks/core.py b/src/prefect/blocks/core.py
--- a/src/prefect/blocks/core.py
+++ b/src/prefect/blocks/core.py
@@ -788,12 +788,14 @@ class Custom(Block):
             ```
 
             Load from Block with a block document slug:
+            ```python
             class Custom(Block):
                 message: str
 
             Custom(message="Hello!").save("my-custom-message")
 
             loaded_block = Block.load("custom/my-custom-message")
+            ```
 
             Migrate a block document to a new schema:
             ```python


Test patch:
Repository: PrefectHQ/prefect

Issue:
Missing default value for "work_pool_id" in FlowRun
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

The object FlowRun defines several fields, most of which are optional. The optional ones all set a default value of `None`, except for `work_pool_id`, which is missing a default. This causes type checkers (in my case Pyright) to demand we explicitly pass in `work_pool_id=None` to the constructor.

This seems like an oversight and would be simple to fix by adding `default=None` to that field.

### Reproduction

```python3
Have `FlowRun(id=flow_run_id, name=flow_run_name, state=Running(), flow_id=flow_id)` in the code and validate with PyRight
```


### Error

```python3
error: Argument missing for parameter "work_pool_id"
```


### Versions

```Text
Version:             2.10.13
API version:         0.8.4
Python version:      3.11.3
Git commit:          179edeac
Built:               Thu, Jun 8, 2023 4:10 PM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         ephemeral
Server:
  Database:          sqlite
  SQLite version:    3.42.0
```


### Additional context

_No response_


Discussion:
Can I take this issue?

Also, would appreciate having more detail on this issue.

Thanks
Alright you got it, just a sec. 

Resolving patch:
diff --git a/src/prefect/server/schemas/core.py b/src/prefect/server/schemas/core.py
--- a/src/prefect/server/schemas/core.py
+++ b/src/prefect/server/schemas/core.py
@@ -873,7 +873,7 @@ class WorkQueue(ORMBaseModel):
     )
     # Will be required after a future migration
     work_pool_id: Optional[UUID] = Field(
-        description="The work pool with which the queue is associated."
+        default=None, description="The work pool with which the queue is associated."
     )
     filter: Optional[QueueFilter] = Field(
         default=None,


Test patch:
Repository: PrefectHQ/prefect

Issue:
`resolve_futures_to_data` should raise on failure by default 
`resolve_futures_to_data` should raise on failures by default and expose a `raise_on_failure` option that is passed to result retrieval from futures.

This behavior changed unintentionally in #9336 

See https://github.com/PrefectHQ/prefect/pull/9336#discussion_r1178815870
            


Discussion:
Hey @madkinsz I want to work on this. Can you assign this to me?

Resolving patch:
diff --git a/src/prefect/futures.py b/src/prefect/futures.py
--- a/src/prefect/futures.py
+++ b/src/prefect/futures.py
@@ -306,7 +306,8 @@ def _collect_futures(futures, expr, context):
 
 
 async def resolve_futures_to_data(
-    expr: Union[PrefectFuture[R, Any], Any]
+    expr: Union[PrefectFuture[R, Any], Any],
+    raise_on_failure: bool = True,
 ) -> Union[R, Any]:
     """
     Given a Python built-in collection, recursively find `PrefectFutures` and build a
@@ -332,7 +333,7 @@ async def resolve_futures_to_data(
         *[
             # We must wait for the future in the thread it was created in
             from_async.call_soon_in_loop_thread(
-                create_call(future._result, raise_on_failure=False)
+                create_call(future._result, raise_on_failure=raise_on_failure)
             ).aresult()
             for future in futures
         ]


Test patch:
diff --git a/tests/test_futures.py b/tests/test_futures.py
--- a/tests/test_futures.py
+++ b/tests/test_futures.py
@@ -7,9 +7,10 @@
 from prefect.client import PrefectClient
 from prefect.flows import flow
 from prefect.futures import PrefectFuture, resolve_futures_to_data
-from prefect.states import Completed
+from prefect.states import Completed, Failed
 from prefect.tasks import task
 from prefect.testing.utilities import assert_does_not_warn
+from prefect.exceptions import FailedRun
 
 mock_client = MagicMock(spec=PrefectClient)()
 mock_client.read_flow_run_states.return_value = [Completed()]
@@ -177,3 +178,38 @@ def if_result_flow():
 
     with assert_does_not_warn():
         if_result_flow._run()
+
+
+async def test_resolve_futures_to_data_raises_exception_default(task_run):
+    future = PrefectFuture(
+        key=str(task_run.id),
+        name="foo",
+        task_runner=None,
+        _final_state=Failed(data="foo"),
+    )
+    future.task_run = task_run
+    future._submitted.set()
+
+    def failed_fun():
+        yield future
+
+    with pytest.raises(FailedRun) as excinfo:
+        await resolve_futures_to_data(failed_fun())
+
+    assert "foo" in str(excinfo.value)
+
+
+async def test_resolve_futures_to_data_dont_raises_exception(task_run):
+    future = PrefectFuture(
+        key=str(task_run.id),
+        name="foo",
+        task_runner=None,
+        _final_state=Failed(data="foo"),
+    )
+    future.task_run = task_run
+    future._submitted.set()
+
+    def failed_fun():
+        yield future
+
+    assert await resolve_futures_to_data(failed_fun(), raise_on_failure=False) == []