nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: dask/dask
Pull request #9054 (2022-05-06 22:24:18)

Additional check on is_dask_collection
- [x] Closes https://github.com/dask/distributed/pull/6299
- [ ] Tests added / passed
- [ ] Passes `pre-commit run --all-files`

There's a test in distributed that checks `is_dask_collection` on a class instead of an instance. Should it only return true for instances? cc @jakirkham 

jakirkham: Windows 3.10 test already passed, but for some reason the status is still showing pending. Going to go ahead and merge to fix CI.

Patch:
diff --git a/dask/base.py b/dask/base.py
index 689e3fe74..b7eef3268 100644
--- a/dask/base.py
+++ b/dask/base.py
@@ -160,7 +160,11 @@ def annotate(**annotations):
 
 def is_dask_collection(x) -> bool:
     """Returns ``True`` if ``x`` is a dask collection"""
-    return hasattr(x, "__dask_graph__") and callable(x.__dask_graph__)
+    return (
+        hasattr(x, "__dask_graph__")
+        and callable(x.__dask_graph__)
+        and not inspect.isclass(x)
+    )
 
 
 class DaskMethodsMixin:


Test patch:
diff --git a/dask/tests/test_base.py b/dask/tests/test_base.py
index 1b30143ad..a72aefcb3 100644
--- a/dask/tests/test_base.py
+++ b/dask/tests/test_base.py
@@ -541,6 +541,7 @@ def test_is_dask_collection():
     assert is_dask_collection(x)
     assert not is_dask_collection(2)
     assert is_dask_collection(DummyCollection({}))
+    assert not is_dask_collection(DummyCollection)
 
 
 def test_unpack_collections():
Repository: dask/dask
Pull request #9168 (2022-06-07 02:21:29)

Add weeks to parse_timedelta
- [ ] Closes #xxxx
- [ ] Tests added / passed
- [ ] Passes `pre-commit run --all-files`



Patch:
diff --git a/dask/utils.py b/dask/utils.py
index 5ee6c0cae..9196c6bd8 100644
--- a/dask/utils.py
+++ b/dask/utils.py
@@ -1601,6 +1601,7 @@ timedelta_sizes = {
     "m": 60,
     "h": 3600,
     "d": 3600 * 24,
+    "w": 7 * 3600 * 24,
 }
 
 tds2 = {
@@ -1608,6 +1609,7 @@ tds2 = {
     "minute": 60,
     "hour": 60 * 60,
     "day": 60 * 60 * 24,
+    "week": 7 * 60 * 60 * 24,
     "millisecond": 1e-3,
     "microsecond": 1e-6,
     "nanosecond": 1e-9,


Test patch:
diff --git a/dask/tests/test_utils.py b/dask/tests/test_utils.py
index b90a51b99..8a08d6110 100644
--- a/dask/tests/test_utils.py
+++ b/dask/tests/test_utils.py
@@ -654,6 +654,8 @@ def test_parse_timedelta():
         ("3500 us", 0.0035),
         ("1 ns", 1e-9),
         ("2m", 120),
+        ("5 days", 5 * 24 * 60 * 60),
+        ("2 w", 2 * 7 * 24 * 60 * 60),
         ("2 minutes", 120),
         (None, None),
         (3, 3),
Repository: dask/dask
Pull request #9184 (2022-06-13 17:05:14)

Deprecate extra `format_time` utility
This is a small follow-up to https://github.com/dask/dask/pull/9116 that deprecates `dask.diagnostics.progress.format_time` in favor of `dask.utils.format_time` 

cc @jacobtomlinson 


Patch:
diff --git a/dask/dataframe/accessor.py b/dask/dataframe/accessor.py
index ad2ec9060..e92dfab84 100644
--- a/dask/dataframe/accessor.py
+++ b/dask/dataframe/accessor.py
@@ -274,6 +274,7 @@ class StringAccessor(Accessor):
 
     @derived_from(pd.core.strings.StringMethods)
     def split(self, pat=None, n=-1, expand=False):
+        """Known inconsistencies: ``expand=True`` with unknown ``n`` will raise a ``NotImplementedError``."""
         return self._split("split", pat=pat, n=n, expand=expand)
 
     @derived_from(pd.core.strings.StringMethods)
diff --git a/dask/diagnostics/progress.py b/dask/diagnostics/progress.py
index b65cde514..4be4a6355 100644
--- a/dask/diagnostics/progress.py
+++ b/dask/diagnostics/progress.py
@@ -5,14 +5,16 @@ import time
 from timeit import default_timer
 
 from dask.callbacks import Callback
+from dask.utils import _deprecated
 
 
+@_deprecated(after_version="2022.6.0", use_instead="dask.utils.format_time")
 def format_time(t):
     """Format seconds into a human readable form.
 
-    >>> format_time(10.4)
+    >>> format_time(10.4)  # doctest: +SKIP
     '10.4s'
-    >>> format_time(1000.4)
+    >>> format_time(1000.4)  # doctest: +SKIP
     '16min 40.4s'
     """
     m, s = divmod(t, 60)
@@ -135,6 +137,8 @@ class ProgressBar(Callback):
             self._draw_bar(ndone / ntasks if ntasks else 0, elapsed)
 
     def _draw_bar(self, frac, elapsed):
+        from dask.utils import format_time
+
         bar = "#" * int(self._width * frac)
         percent = int(100 * frac)
         elapsed = format_time(elapsed)


Test patch:
diff --git a/dask/diagnostics/tests/test_progress.py b/dask/diagnostics/tests/test_progress.py
index 8967a96a0..aa26985fd 100644
--- a/dask/diagnostics/tests/test_progress.py
+++ b/dask/diagnostics/tests/test_progress.py
@@ -59,11 +59,14 @@ def test_clean_exit(get):
 
 
 def test_format_time():
-    assert format_time(1.4) == " 1.4s"
-    assert format_time(10.4) == "10.4s"
-    assert format_time(100.4) == " 1min 40.4s"
-    assert format_time(1000.4) == "16min 40.4s"
-    assert format_time(10000.4) == " 2hr 46min 40.4s"
+    with pytest.warns(FutureWarning, match="dask.utils.format_time") as record:
+        assert format_time(1.4) == " 1.4s"
+        assert format_time(10.4) == "10.4s"
+        assert format_time(100.4) == " 1min 40.4s"
+        assert format_time(1000.4) == "16min 40.4s"
+        assert format_time(10000.4) == " 2hr 46min 40.4s"
+
+    assert len(record) == 5  # Each `assert` above warns
 
 
 def test_register(capsys):
Repository: jupyterhub/binderhub
Pull request #1609 (2023-01-04 11:18:35)

breaking: require k8s 1.21 like z2jh does now


Patch:
diff --git a/helm-chart/binderhub/Chart.yaml b/helm-chart/binderhub/Chart.yaml
index 451aadc1..9b58c8d3 100644
--- a/helm-chart/binderhub/Chart.yaml
+++ b/helm-chart/binderhub/Chart.yaml
@@ -22,7 +22,7 @@ keywords: [jupyter, jupyterhub, binderhub]
 home: https://binderhub.readthedocs.io/en/latest/
 sources: [https://github.com/jupyterhub/binderhub]
 icon: https://jupyterhub.github.io/helm-chart/images/hublogo.svg
-kubeVersion: ">=1.20.0-0"
+kubeVersion: ">=1.21.0-0"
 maintainers:
   # Since it is a requirement of Artifact Hub to have specific maintainers
   # listed, we have added some below, but in practice the entire JupyterHub team
diff --git a/helm-chart/binderhub/schema.yaml b/helm-chart/binderhub/schema.yaml
index 2f360942..19d46352 100644
--- a/helm-chart/binderhub/schema.yaml
+++ b/helm-chart/binderhub/schema.yaml
@@ -79,7 +79,7 @@ properties:
     additionalProperties: true
     description: |
       A k8s native specification of resources, see [the
-      documentation](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#resourcerequirements-v1-core).
+      documentation](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core).
 
   rbac:
     type: object
@@ -343,7 +343,7 @@ properties:
           flag.
 
           See [the k8s
-          documentation](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#probe-v1-core)
+          documentation](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#probe-v1-core)
           for more details.
         required: [enabled]
         properties:
@@ -397,7 +397,7 @@ properties:
             additionalProperties: false
             description: |
               A k8s native specification of lifecycle hooks on the container, see [the
-              documentation](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#lifecycle-v1-core).
+              documentation](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#lifecycle-v1-core).
             properties:
               postStart:
                 type: object


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9a53b64e..71be4934 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -68,7 +68,7 @@ jobs:
           # which isn't documented anywhere, but is currently at 3.5.0. We also
           # test with the latest k8s and helm versions.
           #
-          - k3s-channel: v1.20
+          - k3s-channel: v1.21
             helm-version: v3.5.0
             test: helm
             test-variation: dind
Repository: jupyterhub/binderhub
Pull request #1626 (2023-01-22 21:29:49)

Build memory limits/requests should be `ByteSpecification`
This will hopefully fix https://github.com/jupyterhub/mybinder.org-deploy/pull/2477 on staging, which is failing due to
https://github.com/jupyterhub/mybinder.org-deploy/blob/b6c4eaee1a2f480319a661b15b01fed9880fcafe/mybinder/values.yaml#L162-L163
being rejected.


Patch:
diff --git a/binderhub/build.py b/binderhub/build.py
index 5e0234f0..22fac12f 100644
--- a/binderhub/build.py
+++ b/binderhub/build.py
@@ -19,7 +19,7 @@ from tornado.log import app_log
 from traitlets import Any, Bool, Dict, Integer, Unicode, default
 from traitlets.config import LoggingConfigurable
 
-from .utils import KUBE_REQUEST_TIMEOUT, rendezvous_rank
+from .utils import KUBE_REQUEST_TIMEOUT, ByteSpecification, rendezvous_rank
 
 
 class ProgressEvent:
@@ -91,8 +91,10 @@ class BuildExecutor(LoggingConfigurable):
         config=True,
     )
 
-    memory_limit = Integer(
-        0, help="Memory limit for the build process in bytes", config=True
+    memory_limit = ByteSpecification(
+        0,
+        help="Memory limit for the build process in bytes (optional suffixes K M G T).",
+        config=True,
     )
 
     appendix = Unicode(
@@ -261,10 +263,10 @@ class KubernetesBuildExecutor(BuildExecutor):
         config=True,
     )
 
-    memory_request = Integer(
+    memory_request = ByteSpecification(
         0,
         help=(
-            "Memory request of the build pod. "
+            "Memory request of the build pod in bytes (optional suffixes K M G T). "
             "The actual building happens in the docker daemon, "
             "but setting request in the build pod makes sure that memory is reserved for the docker build "
             "in the node by the kubernetes scheduler."


Test patch:
diff --git a/binderhub/tests/test_build.py b/binderhub/tests/test_build.py
index e2ef2fba..7f7a795e 100644
--- a/binderhub/tests/test_build.py
+++ b/binderhub/tests/test_build.py
@@ -201,6 +201,31 @@ def test_sticky_builds_affinity():
     ].preference.match_expressions[0].values[0] in ("node-a", "node-b")
 
 
+def test_build_memory_limits():
+    # Setup some mock objects for the response from the k8s API
+    mock_k8s_api = _list_image_builder_pods_mock()
+
+    build = KubernetesBuildExecutor(
+        q=mock.MagicMock(),
+        api=mock_k8s_api,
+        name="test_build",
+        namespace="build_namespace",
+        repo_url="repo",
+        ref="ref",
+        build_image="image",
+        image_name="name",
+        push_secret="",
+        memory_limit="2T",
+        memory_request="123G",
+        git_credentials="",
+        docker_host="http://mydockerregistry.local",
+        node_selector={},
+        sticky_builds=True,
+    )
+    assert build.memory_limit == 2199023255552
+    assert build.memory_request == 132070244352
+
+
 def test_git_credentials_passed_to_podspec_upon_submit():
     git_credentials = """{
         "client_id": "my_username",