internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: mars-project/mars

Issue:
[BUG] Mars produces messages too long to open inside an editor
<!--
Thank you for your contribution!

Please review https://github.com/mars-project/mars/blob/master/CONTRIBUTING.rst before opening an issue.
-->

**Describe the bug**
Currently mars print messages when debug mode is enabled, sometimes the messages is very large such decref_stage, and the logs are too long to be opened by the editor
![image](https://user-images.githubusercontent.com/12445254/160067634-4510bd20-dcb8-4248-8914-33cbb207493e.png)


Discussion:

Resolving patch:
diff --git a/mars/oscar/backends/context.py b/mars/oscar/backends/context.py
--- a/mars/oscar/backends/context.py
+++ b/mars/oscar/backends/context.py
@@ -175,9 +175,10 @@ async def send(
             profiling_context=profiling_context,
         )
 
+        # use `%.500` to avoid print too long messages
         with debug_async_timeout(
             "actor_call_timeout",
-            "Calling %r on %s at %s timed out",
+            "Calling %.500r on %s at %s timed out",
             message.content,
             actor_ref.uid,
             actor_ref.address,
diff --git a/mars/oscar/backends/pool.py b/mars/oscar/backends/pool.py
--- a/mars/oscar/backends/pool.py
+++ b/mars/oscar/backends/pool.py
@@ -339,9 +339,10 @@ async def process_message(self, message: _MessageBase, channel: Channel):
         with _ErrorProcessor(
             self.external_address, message.message_id, message.protocol
         ) as processor:
+            # use `%.500` to avoid print too long messages
             with debug_async_timeout(
                 "process_message_timeout",
-                "Process message %s of channel %s timeout.",
+                "Process message %.500s of channel %s timeout.",
                 message,
                 channel,
             ):
diff --git a/mars/oscar/backends/ray/communication.py b/mars/oscar/backends/ray/communication.py
--- a/mars/oscar/backends/ray/communication.py
+++ b/mars/oscar/backends/ray/communication.py
@@ -203,8 +203,9 @@ async def recv(self):
         try:
             # Wait on ray object ref
             message, object_ref = await self._in_queue.get()
+            # use `%.500` to avoid print too long messages
             with debug_async_timeout(
-                "ray_object_retrieval_timeout", "Client sent message is %s", message
+                "ray_object_retrieval_timeout", "Client sent message is %.500s", message
             ):
                 result = await object_ref
             if isinstance(result, RayChannelException):


Test patch:
Repository: mars-project/mars

Issue:
Submit query condition to remote node instead of fetch to local then query
<!--
Thank you for your contribution!

Please review https://github.com/mars-project/mars/blob/master/CONTRIBUTING.rst before opening an issue.
-->

**Is your feature request related to a problem? Please describe.**
Curently if ray fetcher gets objects with condition, it will fetch objects to local, then filter local objects with conditions. This will incur much objects transfer cost and high memory footsprint in local node. 

**Describe the solution you'd like**
We should submit query to objects' node then fetch queried result instead. 




Discussion:

Resolving patch:
diff --git a/mars/services/task/execution/ray/fetcher.py b/mars/services/task/execution/ray/fetcher.py
--- a/mars/services/task/execution/ray/fetcher.py
+++ b/mars/services/task/execution/ray/fetcher.py
@@ -15,9 +15,10 @@
 import asyncio
 from collections import namedtuple
 from typing import Dict, List
+from .....utils import lazy_import
 from ..api import Fetcher, register_fetcher_cls
 
-
+ray = lazy_import("ray")
 _FetchInfo = namedtuple("FetchInfo", ["key", "object_ref", "conditions"])
 
 
@@ -38,18 +39,27 @@ async def append(self, chunk_key: str, chunk_meta: Dict, conditions: List = None
         )
 
     async def get(self):
-        objects = await asyncio.gather(
-            *(info.object_ref for info in self._fetch_info_list)
-        )
         if self._no_conditions:
-            return objects
-        results = []
-        for o, fetch_info in zip(objects, self._fetch_info_list):
+            return await asyncio.gather(
+                *(info.object_ref for info in self._fetch_info_list)
+            )
+        refs = [None] * len(self._fetch_info_list)
+        for index, fetch_info in enumerate(self._fetch_info_list):
             if fetch_info.conditions is None:
-                results.append(o)
+                refs[index] = fetch_info.object_ref
             else:
-                try:
-                    results.append(o.iloc[fetch_info.conditions])
-                except AttributeError:
-                    results.append(o[fetch_info.conditions])
-        return results
+                refs[index] = query_object_with_condition.remote(
+                    fetch_info.object_ref, fetch_info.conditions
+                )
+        return await asyncio.gather(*refs)
+
+
+def query_object_with_condition(o, conditions):
+    try:
+        return o.iloc[conditions]
+    except AttributeError:
+        return o[conditions]
+
+
+if ray:
+    query_object_with_condition = ray.remote(query_object_with_condition)


Test patch:
Repository: mars-project/mars

Issue:
[BUG] wrong index of the last chunk after auto merging
<!--
Thank you for your contribution!

Please review https://github.com/mars-project/mars/blob/master/CONTRIBUTING.rst before opening an issue.
-->

**Describe the bug**
When I run TCP-H 19th query under 10G scale factor，it throws an exception shown below.

![image](https://user-images.githubusercontent.com/36940796/169484323-2da19cb2-552b-4c9a-afb5-1430c8d3b010.png)

or

![image](https://user-images.githubusercontent.com/36940796/169485217-21af8135-5ef2-4f41-bb30-fc84e118bee7.png)

It seems that some input chunk indices are wrong.

After debugging, I found that the last chunk index is wrong after `df.merge()` in TCP-H 19th query.

**To Reproduce**
Run TCP-H 19th query under 10G scale factor in a 5 node cluster.



Discussion:

Resolving patch:
diff --git a/mars/dataframe/utils.py b/mars/dataframe/utils.py
--- a/mars/dataframe/utils.py
+++ b/mars/dataframe/utils.py
@@ -1389,15 +1389,10 @@ def _concat_chunks(merge_chunks: List[ChunkType], output_index: int):
         to_merge_chunks.append(chunk)
         acc_memory_size += chunk_memory_size
     # process the last chunk
-    if len(to_merge_chunks) > 1:
-        merged_chunk = _concat_chunks(to_merge_chunks, len(n_split))
-        out_chunks.append(merged_chunk)
-        n_split.append(merged_chunk.shape[0])
-    else:
-        assert len(to_merge_chunks) == 1
-        last_chunk = to_merge_chunks[0]
-        out_chunks.append(last_chunk)
-        n_split.append(last_chunk.shape[0])
+    assert len(to_merge_chunks) >= 1
+    merged_chunk = _concat_chunks(to_merge_chunks, len(n_split))
+    out_chunks.append(merged_chunk)
+    n_split.append(merged_chunk.shape[0])
 
     new_op = df_or_series.op.copy()
     params = df_or_series.params.copy()


Test patch:
diff --git a/mars/dataframe/tests/test_utils.py b/mars/dataframe/tests/test_utils.py
--- a/mars/dataframe/tests/test_utils.py
+++ b/mars/dataframe/tests/test_utils.py
@@ -614,7 +614,10 @@ def get_chunks_meta(self, data_keys: List[str], **_) -> List[Dict]:
     assert len(df2.chunks) == 2
     assert isinstance(df2.chunks[0].op, DataFrameConcat)
     assert len(df2.chunks[0].op.inputs) == 3
-    assert df2.chunks[1] is df.chunks[-1]
+    assert isinstance(df2.chunks[1].op, DataFrameConcat)
+    assert len(df2.chunks[1].op.inputs) == 1
+    assert df2.chunks[1].shape == df.chunks[-1].shape
+    assert df2.chunks[1].index == (1, 0)
 
     # mock situation that df not executed
     df2 = auto_merge_chunks(FakeContext(False), df, 3 * memory_size)
Repository: mars-project/mars

Issue:
[BUG] There maybe duplicate `WorkerMetaAPI` creation in `TaskStageProcessor`
**Describe the bug**

We can see there is a lot of duplicate `WorkerMetaAPI` creation in the method `_update_result_meta` of `mars/services/task/execution/mars/stage.py` if there is too many chunk result and their bands are same:
```python
for tileable in tile_context.values():
    chunks = [c.data for c in tileable.chunks]
    for c, params_fields in zip(chunks, self._get_params_fields(tileable)):
        address = chunk_to_result[c].meta["bands"][0][0]
        meta_api = await WorkerMetaAPI.create(session_id, address)
        call = meta_api.get_chunk_meta.delay(c.key, fields=params_fields)
        worker_meta_api_to_chunk_delays[meta_api][c] = calll
```
There are 3639 chunk results and 200 workers in my job and it costs 1414s to create worker meta apis.
Maybe we can cache the worker meta apis to avoid duplicate creation.

**To Reproduce**

1. Your Python version: python-3.7.9
2. The version of Mars you use: master



Discussion:

Resolving patch:
diff --git a/mars/services/meta/api/oscar.py b/mars/services/meta/api/oscar.py
--- a/mars/services/meta/api/oscar.py
+++ b/mars/services/meta/api/oscar.py
@@ -237,7 +237,7 @@ async def get_band_chunks(self, band: BandType) -> List[str]:
 
 class MetaAPI(BaseMetaAPI):
     @classmethod
-    @alru_cache(cache_exceptions=False)
+    @alru_cache(maxsize=1024, cache_exceptions=False)
     async def create(cls, session_id: str, address: str) -> "MetaAPI":
         """
         Create Meta API.


Test patch:
Repository: liqd/a4-opin

Issue:
Styling in commenting text
Currently an the `<li>`s in an `<ul>` do not glow/highlight as expected when hovered. An the comment symbol is not part of the link / can't be clicked.



Discussion:

Resolving patch:
diff --git a/euth/documents/models.py b/euth/documents/models.py
--- a/euth/documents/models.py
+++ b/euth/documents/models.py
@@ -31,7 +31,7 @@ def paragraphs_sorted(self):
 
 class Paragraph(base_models.TimeStampedModel):
     name = models.CharField(max_length=120, blank=True)
-    text = RichTextField(config_name='document-editor')
+    text = RichTextField()
     weight = models.PositiveIntegerField()
     document = models.ForeignKey(Document, on_delete=models.CASCADE)
 
diff --git a/euth_wagtail/settings/base.py b/euth_wagtail/settings/base.py
--- a/euth_wagtail/settings/base.py
+++ b/euth_wagtail/settings/base.py
@@ -157,14 +157,13 @@
             ['Bold', 'Italic', 'Underline'],
             ['NumberedList', 'BulletedList'],
             ['Link', 'Unlink']
-        ],
-        'enterMode': 2
+        ]
     }
 }
 
 BLEACH_LIST = {
     'default' : {
-        'tags': ['p','strong','em','u','ol','li','ul','a','br'],
+        'tags': ['p','strong','em','u','ol','li','ul','a'],
         'attributes': {
             'a': ['href', 'rel']
         }


Test patch:
Repository: liqd/a4-opin

Issue:
Filter draft projects from all listings
Projects that are in draft mode should be removed from most listings:
- [x] latest projects for all users
- [x] other projects for all users
- [x] organisation page for non-initiators



Discussion:

Resolving patch:
diff --git a/euth/organisations/views.py b/euth/organisations/views.py
--- a/euth/organisations/views.py
+++ b/euth/organisations/views.py
@@ -6,6 +6,12 @@
 class OrganisationDetailView(generic.DetailView):
     model = models.Organisation
 
+    def visible_projects(self):
+        if self.request.user in self.object.initiators.all():
+            return self.object.project_set.all()
+        else:
+            return self.object.project_set.filter(is_draft=False)
+
 
 class OrganisationListView(generic.ListView):
     model = models.Organisation
diff --git a/euth/projects/models.py b/euth/projects/models.py
--- a/euth/projects/models.py
+++ b/euth/projects/models.py
@@ -66,8 +66,8 @@ def has_member(self, user):
 
     @functional.cached_property
     def other_projects(self):
-        other_projects = self.organisation.project_set.all().exclude(
-            slug=self.slug)
+        other_projects = self.organisation.project_set\
+            .filter(is_draft=False).exclude(slug=self.slug)
         return other_projects
 
     @functional.cached_property


Test patch:
Repository: liqd/a4-opin

Issue:
Choose template: Small issues
There are some small wording issues when you choose a template to create a project in the dashboard. See comments in screenshot.

![unknown-18](https://cloud.githubusercontent.com/assets/15341015/18997556/467cc690-8735-11e6-9764-b150f0865098.png)



Discussion:

Resolving patch:
diff --git a/euth/dashboard/templatetags/__init__.py b/euth/dashboard/templatetags/__init__.py
deleted file mode 100644
diff --git a/euth/dashboard/templatetags/dashboard_templatetags.py b/euth/dashboard/templatetags/dashboard_templatetags.py
deleted file mode 100644
--- a/euth/dashboard/templatetags/dashboard_templatetags.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from django import template
-
-register = template.Library()
-
-
-@register.simple_tag
-def selected(request, pattern):
-    path = request.path
-    if path == pattern:
-        return 'selected'
-    return ''
diff --git a/euth/dashboard/urls.py b/euth/dashboard/urls.py
--- a/euth/dashboard/urls.py
+++ b/euth/dashboard/urls.py
@@ -10,47 +10,57 @@
     url(
         r'^profile$',
         views.DashboardProfileView.as_view(),
+        {'dashboard_menu_item': 'profile'},
         name='dashboard-profile'),
     url(
         r'^email/$',
         views.DashboardEmailView.as_view(),
+        {'dashboard_menu_item': 'email'},
         name='dashboard-email'
     ),
     url(
         r'^connections/$',
         views.DashboardAccountView.as_view(),
+        {'dashboard_menu_item': 'connections'},
         name='dashboard-connections'
     ),
     url(
         r'^(?P<organisation_slug>[-\w_]+)/$',
         views.DashboardOrganisationUpdateView.as_view(),
+        {'dashboard_menu_item': 'organisation'},
         name='dashboard-organisation-edit'
     ),
     url(
         r'^(?P<organisation_slug>[-\w_]+)/projects/$',
         views.DashboardProjectListView.as_view(),
+        {'dashboard_menu_item': 'project'},
         name='dashboard-project-list'),
     url(r'^(?P<organisation_slug>[-\w_]+)/blueprints/$',
         views.DashboardBlueprintListView.as_view(),
+        {'dashboard_menu_item': 'project'},
         name='dashboard-blueprint-list'),
     url(r'^(?P<organisation_slug>[-\w_]+)/blueprints/'
         r'(?P<blueprint_slug>[-\w_]+)/$',
         views.DashboardProjectCreateView.as_view(),
+        {'dashboard_menu_item': 'project'},
         name='dashboard-project-create'),
     url(
         r'^(?P<organisation_slug>[-\w_]+)/projects/(?P<slug>[-\w_]+)/$',
         views.DashboardProjectUpdateView.as_view(),
+        {'dashboard_menu_item': 'project'},
         name='dashboard-project-edit'
     ),
     url(
         r'^(?P<organisation_slug>[-\w_]+)/projects/(?P<slug>[-\w_]+)/users$',
         views.DashboardProjectUserView.as_view(),
+        {'dashboard_menu_item': 'project'},
         name='dashboard-project-users'
     ),
     url(
         r'^(?P<organisation_slug>[-\w_]+)/projects/'
         r'(?P<slug>[-\w_]+)/users/invite$',
         views.DashboardProjectInviteView.as_view(),
+        {'dashboard_menu_item': 'project'},
         name='dashboard-project-invite'
     ),
 ]


Test patch:
Repository: liqd/a4-opin

Issue:
Name of Template visible while creating the project
Hi, when creating a project with a template it would be helpful to see the name of the project type. Maybe in the black button? 
The author/creator currently has no idea which template s/he chose and in case s/he saves it and returns to it, it may appear helpful to know which one s/he choose. Thanks & Best

![bildschirmfoto 2016-10-06 um 13 43 25](https://cloud.githubusercontent.com/assets/13625047/19151541/80ffe6b6-8bcd-11e6-8ca9-fb7e778f91fe.png)



Discussion:

Resolving patch:
diff --git a/euth/dashboard/views.py b/euth/dashboard/views.py
--- a/euth/dashboard/views.py
+++ b/euth/dashboard/views.py
@@ -125,6 +125,11 @@ class DashboardProjectCreateView(DashboardBaseMixin,
     success_message = _('Project succesfully created.')
     permission_required = 'euth_organisations.initiate_project'
 
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['heading'] = _("New project based on")
+        return context
+
     def get_permission_object(self):
         return self.organisation
 
@@ -155,6 +160,11 @@ class DashboardProjectUpdateView(DashboardBaseMixin,
     success_message = _('Project successfully updated.')
     permission_required = 'euth_organisations.initiate_project'
 
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['heading'] = _("Update project: " + self.object.name)
+        return context
+
     def get_permission_object(self):
         return self.organisation
 


Test patch:
Repository: liqd/a4-opin

Issue:
timeline wrong way?
the phases in the timeline seem to be sorted in the wrong direction:
![bildschirmfoto 2016-10-21 um 13 33 06](https://cloud.githubusercontent.com/assets/2905743/19597159/1eee7114-9793-11e6-97f9-5acd3d610f46.png)
![bildschirmfoto 2016-10-21 um 13 33 18](https://cloud.githubusercontent.com/assets/2905743/19597161/22f8492e-9793-11e6-97a6-8b7e4e2b4388.png)



Discussion:

Resolving patch:
diff --git a/euth/phases/models.py b/euth/phases/models.py
--- a/euth/phases/models.py
+++ b/euth/phases/models.py
@@ -26,6 +26,9 @@ class Phase(models.Model):
 
     objects = PhasesQuerySet.as_manager()
 
+    class Meta:
+        ordering = ['type']
+
     def __str__(self):
         return '{} ({})'.format(self.name, self.type)
 


Test patch:
diff --git a/tests/projects/test_project_models.py b/tests/projects/test_project_models.py
--- a/tests/projects/test_project_models.py
+++ b/tests/projects/test_project_models.py
@@ -93,3 +93,12 @@ def test_image_deleted_after_update(project_factory, ImagePNG):
 
     assert not os.path.isfile(image_path)
     assert not os.path.isfile(thumbnail_path)
+
+
+@pytest.mark.django_db
+def test_phases_property(module, phase_factory):
+    project = module.project
+    phase1 = phase_factory(module=module, type='fake:30:type')
+    phase2 = phase_factory(module=module, type='fake:20:type')
+
+    assert list(project.phases) == [phase2, phase1]
Repository: liqd/a4-opin

Issue:
fix function in api.js to use contenttype json and fix all react components



Discussion:

Resolving patch:
diff --git a/euth_wagtail/settings/base.py b/euth_wagtail/settings/base.py
--- a/euth_wagtail/settings/base.py
+++ b/euth_wagtail/settings/base.py
@@ -317,6 +317,14 @@
 ACCOUNT_LOGOUT_REDIRECT_URL = '/'
 SOCIALACCOUNT_EMAIL_VERIFICATION = False
 
+# Rest framework
+
+REST_FRAMEWORK = {
+    'DEFAULT_PARSER_CLASSES': (
+        'rest_framework.parsers.JSONParser',
+    )
+}
+
 # Euth settings
 
 COMMENTABLES = (


Test patch:
Repository: liqd/a4-opin

Issue:
Specify "Key" in creating mobile polling project
Hey A-Team, setting up a mobile polling works, thanks for that. For a better understanding how to import the poll from Flashpoll, namely via the ID, we might want to add that information to the create project field. Maybe change "key" to "Flashpoll ID" and add a screenshot of it where to find it? Thanks a lot :) 

![bildschirmfoto 2016-10-19 um 13 20 09](https://cloud.githubusercontent.com/assets/13625047/19518663/a45ad644-9608-11e6-87c3-8d19bc9e4252.png)



Discussion:

Resolving patch:
diff --git a/euth/flashpoll/migrations/0002_add_verbose_name_to_token.py b/euth/flashpoll/migrations/0002_add_verbose_name_to_token.py
new file mode 100644
--- /dev/null
+++ b/euth/flashpoll/migrations/0002_add_verbose_name_to_token.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('euth_flashpoll', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='flashpoll',
+            name='key',
+            field=models.CharField(verbose_name='Flashpoll ID', max_length=30),
+        ),
+    ]
diff --git a/euth/flashpoll/models.py b/euth/flashpoll/models.py
--- a/euth/flashpoll/models.py
+++ b/euth/flashpoll/models.py
@@ -1,10 +1,11 @@
 from django.db import models
+from django.utils.translation import ugettext as _
 
 from euth.modules import models as module_models
 
 
 class Flashpoll(module_models.AbstractSettings):
-    key = models.CharField(max_length=30)
+    key = models.CharField(max_length=30, verbose_name=_('Flashpoll ID'))
 
     def __str__(self):
         return self.key


Test patch:
Repository: liqd/a4-opin

Issue:
Typo in description in "Access to project description"
Hey, there is a typo: "...will always be visible to everyone". Thanks for fixing :)

![bildschirmfoto 2016-11-01 um 17 50 05](https://cloud.githubusercontent.com/assets/13625047/19898733/8c42a154-a05d-11e6-8438-433600134765.png)



Discussion:

Resolving patch:
diff --git a/euth/projects/migrations/0007_fix_typo_in_is_public_helptext.py b/euth/projects/migrations/0007_fix_typo_in_is_public_helptext.py
new file mode 100644
--- /dev/null
+++ b/euth/projects/migrations/0007_fix_typo_in_is_public_helptext.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('euth_projects', '0006_add_helptext_and_verbose_name_to_is_public'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='project',
+            name='is_public',
+            field=models.BooleanField(verbose_name='Access to the project', help_text='Please indicate who should be able to participate in your project. Teasers for your project including title and short description will always be visible to everyone', default=True),
+        ),
+    ]
diff --git a/euth/projects/models.py b/euth/projects/models.py
--- a/euth/projects/models.py
+++ b/euth/projects/models.py
@@ -51,7 +51,7 @@ class Project(base_models.TimeStampedModel):
         verbose_name=_('Access to the project'),
         help_text=_('Please indicate who should be able to participate in '
                     'your project. Teasers for your project including title '
-                    'and short description will always be visble to everyone')
+                    'and short description will always be visible to everyone')
     )
     is_draft = models.BooleanField(default=True)
     image = models.ImageField(


Test patch: