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

Issue:
Standardize process work pool type name in the UI and CLI (process vs. subprocess)
### 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

Local Subprocess is the term when creating a work pool in the UI
<img width="913" alt="Screenshot 2023-09-27 at 6 12 28 PM" src="https://github.com/PrefectHQ/prefect/assets/7703961/1b0fbba6-90b4-4305-99a2-7e4f833678e4">

After creation in the UI it is referred to as a Process work pool.
<img width="488" alt="Screenshot 2023-09-27 at 6 13 11 PM" src="https://github.com/PrefectHQ/prefect/assets/7703961/0ac0cb1e-eb30-40f6-b34d-2ed757cca051">

<img width="210" alt="Screenshot 2023-09-27 at 6 13 34 PM" src="https://github.com/PrefectHQ/prefect/assets/7703961/657aea2b-c13e-45af-978e-c48c4bf2463b">

The CLI also refers to it as a process work pool.
<img width="446" alt="Screenshot 2023-09-27 at 6 14 37 PM" src="https://github.com/PrefectHQ/prefect/assets/7703961/66fd13ca-ba1b-4540-bf2c-417db40a1ba9">




### Describe the proposed behavior

Standardizing on process or subprocess would be good for users.

### Example Use

_No response_

### Additional context

_No response_


Discussion:
Hey @jakekaplan, I would like to work on this can I get started ?
Hi @jakekaplan  ,

I'm looking for some "good first issue" related to coding and would like to work on this.

Could you please assign it to me? Thanks.
Hi @AddoZhu - sorry for the delay, sounds great! Reach out if you'd like to pair.
Unassigning as there's been no activity here
I can take this. Would plan to standardize on "Process" 

Resolving patch:
diff --git a/src/prefect/workers/process.py b/src/prefect/workers/process.py
--- a/src/prefect/workers/process.py
+++ b/src/prefect/workers/process.py
@@ -13,6 +13,7 @@
 For more information about work pools and workers,
 checkout out the [Prefect docs](/concepts/work-pools/).
 """
+
 import asyncio
 import contextlib
 import os
@@ -142,7 +143,7 @@ class ProcessWorker(BaseWorker):
         "Execute flow runs as subprocesses on a worker. Works well for local execution"
         " when first getting started."
     )
-    _display_name = "Local Subprocess"
+    _display_name = "Process"
     _documentation_url = (
         "https://docs.prefect.io/latest/api-ref/prefect/workers/process/"
     )


Test patch:
Repository: PrefectHQ/prefect

Issue:
Tasks should log when they're retrying
### 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

3.x

### Describe the current behavior

When task runs are retried the only messaging suggesting that a retry is happening is `Waiting for scheduled time 2024-06-07 14:54:31.904073+00:00 for task <task_name>`. Similarly when a task runs out of retries just a failure message is printed no message about exhausting retries.

### Describe the proposed behavior

There should be some messaging about the task being retried and ideally a message about the task having exhausted those retries when it continues to fail.

### Example Use

_No response_

### Additional context

_No response_


Discussion:
![Screenshot 2024-06-07 at 11 32 01 AM](https://github.com/PrefectHQ/prefect/assets/354286/73a25b68-bc5b-4e2a-a7f3-f18aa1688c50)


Resolving patch:
diff --git a/src/prefect/task_engine.py b/src/prefect/task_engine.py
--- a/src/prefect/task_engine.py
+++ b/src/prefect/task_engine.py
@@ -333,10 +333,24 @@ def handle_retry(self, exc: Exception) -> bool:
                     scheduled_time=pendulum.now("utc").add(seconds=delay)
                 )
             else:
+                delay = None
                 new_state = Retrying()
+
+            self.logger.info(
+                f"Task run failed with exception {exc!r} - "
+                f"Retry {self.retries + 1}/{self.task.retries} will start "
+                f"{str(delay) + ' second(s) from now' if delay else 'immediately'}"
+            )
+
             self.set_state(new_state, force=True)
             self.retries = self.retries + 1
             return True
+        elif self.retries >= self.task.retries:
+            self.logger.error(
+                f"Task run failed with exception {exc!r} - Retries are exhausted"
+            )
+            return False
+
         return False
 
     def handle_exception(self, exc: Exception) -> None:
@@ -499,9 +513,6 @@ def is_running(self) -> bool:
     async def wait_until_ready(self):
         """Waits until the scheduled time (if its the future), then enters Running."""
         if scheduled_time := self.state.state_details.scheduled_time:
-            self.logger.info(
-                f"Waiting for scheduled time {scheduled_time} for task {self.task.name!r}"
-            )
             await anyio.sleep((scheduled_time - pendulum.now("utc")).total_seconds())
             self.set_state(
                 Retrying() if self.state.name == "AwaitingRetry" else Running(),


Test patch:
Repository: PrefectHQ/prefect

Issue:
Make the integrations tab more visual, emphasizing logos



Discussion:
At a minimum, we need the list of all integration packages on the Integrations page, might as well add the lovely logo grid. 
If we run a script once we should be good for now.
For the the future, we could automatically run the script if a new integration is added to a triggering list or folder.
I was able to use mkdocs with a script to generate this grid of logos, but the css and html required, combined with how rarely this information changes, leads me to believe it is better to just use cards to generate this manually. I have a POC inn the works and should be done by Monday.

Resolving patch:
diff --git a/docs/integrations/create_integrations_cards.py b/docs/integrations/create_integrations_cards.py
new file mode 100644
--- /dev/null
+++ b/docs/integrations/create_integrations_cards.py
@@ -0,0 +1,41 @@
+"""Script to generate the integrations (formerly integrations) catalog table"""
+
+import glob
+from pathlib import Path
+
+import mkdocs_gen_files
+import yaml
+from jinja2 import Environment, FileSystemLoader, select_autoescape
+
+with mkdocs_gen_files.open("./integrations/index.md", "w") as markdown_file:
+    # Get file paths for all integrations files
+    integration_files = [
+        file
+        for file in glob.glob("./docs/integrations/catalog/*.yaml")
+        # Ignore the template file
+        if Path(file).name != "TEMPLATE.yaml"
+    ]
+
+    # Load integration information from YAML files into a list
+    integration_configs = []
+    for integration_file in integration_files:
+        with open(integration_file, "r") as file:
+            integration_configs.append(yaml.safe_load(file))
+
+    # Sort integrations alphabetically by name
+    sorted_integration_configs = sorted(
+        integration_configs, key=lambda x: x["tag"].lower()
+    )
+
+    tags = [config["tag"] for config in sorted_integration_configs]
+
+    env = Environment(
+        loader=FileSystemLoader("./"),
+        autoescape=select_autoescape(enabled_extensions="html"),
+    )
+    template = env.get_template("index.md")
+
+    # Use jinja2 template and in index.md and write out to index.html
+    markdown_file.write(
+        template.render(integrations=sorted_integration_configs, tags=tags)
+    )


Test patch:
Repository: ocadotechnology/aimmo

Issue:
Submitting empty code leads to server error
When sending empty program, we are getting:

Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
1.                     response = wrapped_callback(request, _callback_args, *_callback_kwargs)
   File "/Library/Python/2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
2.                 return view_func(request, _args, *_kwargs)
   File "/Users/paulina.koch/Documents/C4L/forks/aimmo/ui/players/views.py" in code
3.             world.player_changed_code(request.user.id, request.user.player.code)
   File "/Users/paulina.koch/Documents/C4L/forks/aimmo/simulation/game_state.py" in player_changed_code
4.             avatar.set_code(code)
   File "/Users/paulina.koch/Documents/C4L/forks/aimmo/simulation/avatar/avatar_wrapper.py" in set_code
5.         self.avatar = Avatar()

Exception Type: TypeError at /api/code/
Exception Value: 'NoneType' object is not callable

Simple check should be enough, but we could use it as a chance to implement an extension of validation or error handling/printing when submitting code.



Discussion:

Resolving patch:
diff --git a/simulation/avatar/avatar_wrapper.py b/simulation/avatar/avatar_wrapper.py
--- a/simulation/avatar/avatar_wrapper.py
+++ b/simulation/avatar/avatar_wrapper.py
@@ -60,9 +60,9 @@ def set_code(self, code):
         self.code = code
         try:
             exec(code)
+            self.avatar = Avatar()
         except Exception as ex:
             raise UserCodeException("Exception in user code", ex)
-        self.avatar = Avatar()
 
     def __repr__(self):
         return 'Avatar(id={}, location={}, health={}, score={})'.format(self.player_id, self.location,


Test patch:
Repository: ocadotechnology/aimmo

Issue:
Fix warning about deprecation of TEMPLATE_DEBUG
When starting aimmo locally the following message is displayed:

> WARNINGS:
> ?: (1_8.W001) The standalone TEMPLATE_\* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG.

The value in question is in `aimmo/example_project/example_project/settings.py`:
`TEMPLATE_DEBUG = DEBUG`

The TEMPLATES dictionary _maybe_ the one here `aimmo/players/autoconfig.py` (?):

```
'TEMPLATES': [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'APP_DIRS': True,
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.debug',
                    'django.template.context_processors.request',
                    'django.contrib.auth.context_processors.auth',
                    'django.contrib.messages.context_processors.messages',
                ]
            }
        }
    ],
```



Discussion:

Resolving patch:
diff --git a/example_project/example_project/settings.py b/example_project/example_project/settings.py
--- a/example_project/example_project/settings.py
+++ b/example_project/example_project/settings.py
@@ -38,7 +38,6 @@
 import os
 
 DEBUG = True
-TEMPLATE_DEBUG = DEBUG
 
 DATABASES = {
     'default': {


Test patch:
Repository: ocadotechnology/aimmo

Issue:
Deal with users without a Player object



Discussion:

Resolving patch:
diff --git a/players/migrations/0002_auto_20160601_1914.py b/players/migrations/0002_auto_20160601_1914.py
new file mode 100644
--- /dev/null
+++ b/players/migrations/0002_auto_20160601_1914.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('players', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='avatar',
+            name='player',
+        ),
+        migrations.DeleteModel(
+            name='Avatar',
+        ),
+    ]
diff --git a/players/models.py b/players/models.py
--- a/players/models.py
+++ b/players/models.py
@@ -5,8 +5,3 @@
 class Player(models.Model):
     user = models.OneToOneField(User)
     code = models.TextField()
-
-
-# TODO: switch code back  to Avatar from Player to support players undoing their code changes
-class Avatar(models.Model):
-    player = models.ForeignKey(User)
diff --git a/players/views.py b/players/views.py
--- a/players/views.py
+++ b/players/views.py
@@ -22,10 +22,6 @@ def register(request):
         if form.is_valid():
             user = form.save()
 
-            with open("players/avatar_examples/dumb_avatar.py") as initial_code_file:
-                initial_code = initial_code_file.read()
-
-            Player(user=user, code=initial_code).save()
             authenticated_user = authenticate(username=form.cleaned_data['username'], password=form.cleaned_data['password1'])
             login(request, authenticated_user)
             return redirect('program')
@@ -34,14 +30,6 @@ def register(request):
     return render(request, 'accounts/register.html', {'form': form})
 
 
-def _post_code_error_response(message):
-    return create_response("USER_ERROR", message)
-
-
-def _post_server_error_response(message):
-    return create_response("SERVER_ERROR", message)
-
-
 def _post_code_success_response(message):
     return create_response("SUCCESS", message)
 
@@ -56,13 +44,19 @@ def create_response(status, message):
 
 @login_required
 def code(request):
+    try:
+        player = request.user.player
+    except Player.DoesNotExist:
+        with open("players/avatar_examples/dumb_avatar.py") as initial_code_file:
+            initial_code = initial_code_file.read()
+        player = Player.objects.create(user=request.user, code=initial_code)
     if request.method == 'POST':
-        request.user.player.code = request.POST['code']
-        request.user.player.save()
+        player.code = request.POST['code']
+        player.save()
 
         return _post_code_success_response("Your code was saved!")
     else:
-        return HttpResponse(request.user.player.code)
+        return HttpResponse(player.code)
 
 def games(request):
     response = {


Test patch:
Repository: ocadotechnology/aimmo

Issue:
in portal/rr, when you are redirected to home, you are redirected to AI:MMO home
The website now loads the aimmo urls.
But now each time the website is supposed to redirect you to the portal home, it redirects to the AI:MMO login page.
Probably because both urls are named the same in their respective urls.py and the website imports both, finishing with aimmo urls?



Discussion:

Resolving patch:
diff --git a/players/autoconfig.py b/players/autoconfig.py
--- a/players/autoconfig.py
+++ b/players/autoconfig.py
@@ -37,7 +37,7 @@
 '''Players autoconfig'''
 
 DEFAULT_SETTINGS = {
-    'AUTOCONFIG_INDEX_VIEW': 'home',
+    'AUTOCONFIG_INDEX_VIEW': 'aimmo/home',
     'STATIC_URL': '/static/',
 }
 
diff --git a/players/urls.py b/players/urls.py
--- a/players/urls.py
+++ b/players/urls.py
@@ -6,14 +6,14 @@
 from players import views
 
 urlpatterns = [
-    url(r'^$', staff_member_required(TemplateView.as_view(template_name='players/home.html')), name='home'),
+    url(r'^$', staff_member_required(TemplateView.as_view(template_name='players/home.html')), name='aimmo/home'),
 
-    url(r'^program/$', staff_member_required(login_required(TemplateView.as_view(template_name='players/program.html'))), name='program'),
-    url(r'^watch/$', staff_member_required(views.WatchView.as_view()), name='watch'),
-    url(r'^statistics/$', staff_member_required(TemplateView.as_view(template_name='players/statistics.html')), name='statistics'),
+    url(r'^program/$', staff_member_required(login_required(TemplateView.as_view(template_name='players/program.html'))), name='aimmo/program'),
+    url(r'^watch/$', staff_member_required(views.WatchView.as_view()), name='aimmo/watch'),
+    url(r'^statistics/$', staff_member_required(TemplateView.as_view(template_name='players/statistics.html')), name='aimmo/statistics'),
 
-    url(r'^api/code/$', staff_member_required(views.code), name='code'),
-    url(r'^api/games/$', views.games, name='games'),
+    url(r'^api/code/$', staff_member_required(views.code), name='aimmo/code'),
+    url(r'^api/games/$', views.games, name='aimmo/games'),
 
-    url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='js_reverse'),  # TODO: Pull request to make django_js_reverse.urls
+    url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),  # TODO: Pull request to make django_js_reverse.urls
 ]


Test patch:
Repository: ocadotechnology/aimmo

Issue:
Users should see which avatar is theirs



Discussion:

Resolving patch:
diff --git a/players/views.py b/players/views.py
--- a/players/views.py
+++ b/players/views.py
@@ -65,4 +65,5 @@ class WatchView(TemplateView):
     def get_context_data(self, **kwargs):
         context = super(WatchView, self).get_context_data(**kwargs)
         context['game_url_base'], context['game_url_path'] = app_settings.GAME_SERVER_LOCATION_FUNCTION('main')
+        context['current_user_player_key'] = self.request.user.pk
         return context


Test patch:
Repository: ocadotechnology/aimmo

Issue:
Improve error handling when getting worker actions.
Have `AvatarWrapper.decide_action` default to setting a `WaitAction` if anything goes wrong.



Discussion:

Resolving patch:
diff --git a/aimmo-game/service.py b/aimmo-game/service.py
--- a/aimmo-game/service.py
+++ b/aimmo-game/service.py
@@ -124,7 +124,7 @@ def run_game():
 
 
 if __name__ == '__main__':
-    logging.basicConfig(level=logging.DEBUG)
+    logging.basicConfig(level=logging.INFO)
 
     socketio.init_app(app, resource=os.environ.get('SOCKETIO_RESOURCE', 'socket.io'))
     run_game()
diff --git a/aimmo-game/simulation/avatar/avatar_wrapper.py b/aimmo-game/simulation/avatar/avatar_wrapper.py
--- a/aimmo-game/simulation/avatar/avatar_wrapper.py
+++ b/aimmo-game/simulation/avatar/avatar_wrapper.py
@@ -1,7 +1,7 @@
 import logging
 import requests
 
-from simulation.action import ACTIONS, MoveAction
+from simulation.action import ACTIONS, MoveAction, WaitAction
 
 LOGGER = logging.getLogger(__name__)
 
@@ -31,25 +31,34 @@ def action(self):
     def is_moving(self):
         return isinstance(self.action, MoveAction)
 
+    def _fetch_action(self, state_view):
+        return requests.post(self.worker_url, json=state_view).json()
+
+    def _construct_action(self, data):
+        action_data = data['action']
+        action_type = action_data['action_type']
+        action_args = action_data.get('options', {})
+        action_args['avatar'] = self
+        return ACTIONS[action_type](**action_args)
+
     def decide_action(self, state_view):
         try:
-            data = requests.post(self.worker_url, json=state_view).json()
-        except ValueError as err:
-            LOGGER.info('Failed to get turn result: %s', err)
-            return False
+            data = self._fetch_action(state_view)
+            action = self._construct_action(data)
+
+        except (KeyError, ValueError) as err:
+            LOGGER.info('Bad action data supplied: %s', err)
+        except requests.exceptions.ConnectionError:
+            LOGGER.info('Could not connect to worker, probably not ready yet')
+        except Exception:
+            LOGGER.exception("Unknown error while fetching turn data")
+
         else:
-            try:
-                action_data = data['action']
-                action_type = action_data['action_type']
-                action_args = action_data.get('options', {})
-                action_args['avatar'] = self
-                action = ACTIONS[action_type](**action_args)
-            except (KeyError, ValueError) as err:
-                LOGGER.info('Bad action data supplied: %s', err)
-                return False
-            else:
-                self._action = action
-                return True
+            self._action = action
+            return True
+
+        self._action = WaitAction(self)
+        return False
 
     def clear_action(self):
         self._action = None


Test patch:
Repository: ocadotechnology/aimmo

Issue:
Remove "staff required" for aimmo pages when URL viewing restrictions are merged
Will require https://github.com/ocadotechnology/codeforlife-deploy-appengine/pull/35


Discussion:

Resolving patch:
diff --git a/example_project/example_project/settings.py b/example_project/example_project/settings.py
--- a/example_project/example_project/settings.py
+++ b/example_project/example_project/settings.py
@@ -62,6 +62,8 @@
 
 INSTALLED_APPS = (
     'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
     'players',
 )
 
@@ -87,6 +89,16 @@
     }
 }
 
+LOGIN_URL = '/players/accounts/login/'
+
+MIDDLEWARE_CLASSES = [
+   'django.contrib.sessions.middleware.SessionMiddleware',
+   'django.middleware.locale.LocaleMiddleware',
+   'django.middleware.common.CommonMiddleware',
+   'django.middleware.csrf.CsrfViewMiddleware',
+   'django.contrib.auth.middleware.AuthenticationMiddleware',
+   'django.contrib.messages.middleware.MessageMiddleware',
+]
 
 def get_url(game):
     if os.environ.get('AIMMO_MODE', '') == 'minikube':
diff --git a/players/urls.py b/players/urls.py
--- a/players/urls.py
+++ b/players/urls.py
@@ -1,18 +1,19 @@
 from django.conf.urls import url
 from django.views.generic import TemplateView
+from django.contrib.auth import views as auth_views
 from django.contrib.auth.decorators import login_required
-from django.contrib.admin.views.decorators import staff_member_required
 
 from players import views
 
 urlpatterns = [
-    url(r'^$', staff_member_required(TemplateView.as_view(template_name='players/home.html')), name='aimmo/home'),
+    url(r'^$', TemplateView.as_view(template_name='players/home.html'), name='aimmo/home'),
 
-    url(r'^program/$', staff_member_required(login_required(TemplateView.as_view(template_name='players/program.html'))), name='aimmo/program'),
-    url(r'^watch/$', staff_member_required(views.WatchView.as_view()), name='aimmo/watch'),
-    url(r'^statistics/$', staff_member_required(TemplateView.as_view(template_name='players/statistics.html')), name='aimmo/statistics'),
+    url(r'^program/$', login_required(TemplateView.as_view(template_name='players/program.html')), name='aimmo/program'),
+    url(r'^accounts/login/$', auth_views.login),
+    url(r'^watch/$', views.WatchView.as_view(), name='aimmo/watch'),
+    url(r'^statistics/$', TemplateView.as_view(template_name='players/statistics.html'), name='aimmo/statistics'),
 
-    url(r'^api/code/$', staff_member_required(views.code), name='aimmo/code'),
+    url(r'^api/code/$', views.code, name='aimmo/code'),
     url(r'^api/games/$', views.games, name='aimmo/games'),
 
     url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),  # TODO: Pull request to make django_js_reverse.urls


Test patch: