prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Retry jobs that finish with `ClientConnection` error?
  Maybe here: https://github.com/huggingface/datasets-server/blob/f311a9212aaa91dd0373e5c2d4f5da9b6bdabcb5/chart/env/prod.yaml#L209
  
  Internal conversation on Slack: https://huggingface.slack.com/archives/C0311GZ7R6K/p1698224875005729
  
  Anyway: I'm wondering if we can have the error now that the dataset scripts are disabled by default.
  
  </issue>
  <code>
  [start of libs/libcommon/src/libcommon/constants.py]
  1 # SPDX-License-Identifier: Apache-2.0
  2 # Copyright 2022 The HuggingFace Authors.
  3 
  4 CACHE_COLLECTION_RESPONSES = "cachedResponsesBlue"
  5 CACHE_MONGOENGINE_ALIAS = "cache"
  6 HF_DATASETS_CACHE_APPNAME = "hf_datasets_cache"
  7 PARQUET_METADATA_CACHE_APPNAME = "datasets_server_parquet_metadata"
  8 DESCRIPTIVE_STATISTICS_CACHE_APPNAME = "datasets_server_descriptive_statistics"
  9 DUCKDB_INDEX_CACHE_APPNAME = "datasets_server_duckdb_index"
  10 DUCKDB_INDEX_DOWNLOADS_SUBDIRECTORY = "downloads"
  11 DUCKDB_INDEX_JOB_RUNNER_SUBDIRECTORY = "job_runner"
  12 CACHE_METRICS_COLLECTION = "cacheTotalMetric"
  13 QUEUE_METRICS_COLLECTION = "jobTotalMetric"
  14 METRICS_MONGOENGINE_ALIAS = "metrics"
  15 QUEUE_COLLECTION_JOBS = "jobsBlue"
  16 QUEUE_COLLECTION_LOCKS = "locks"
  17 QUEUE_MONGOENGINE_ALIAS = "queue"
  18 QUEUE_TTL_SECONDS = 600  # 10 minutes
  19 LOCK_TTL_SECONDS_NO_OWNER = 600  # 10 minutes
  20 LOCK_TTL_SECONDS_TO_START_JOB = 600  # 10 minutes
  21 LOCK_TTL_SECONDS_TO_WRITE_ON_GIT_BRANCH = 3600  # 1 hour
  22 
  23 MAX_FAILED_RUNS = 3
  24 DATASET_SEPARATOR = "--"
  25 DEFAULT_DIFFICULTY = 50
  26 DEFAULT_DIFFICULTY_MAX = 100
  27 DEFAULT_DIFFICULTY_MIN = 0
  28 DEFAULT_INPUT_TYPE = "dataset"
  29 DEFAULT_JOB_RUNNER_VERSION = 1
  30 DIFFICULTY_BONUS_BY_FAILED_RUNS = 20
  31 MIN_BYTES_FOR_BONUS_DIFFICULTY = 3_000_000_000
  32 
  33 PROCESSING_STEP_CONFIG_PARQUET_AND_INFO_ROW_GROUP_SIZE_FOR_AUDIO_DATASETS = 100
  34 PROCESSING_STEP_CONFIG_PARQUET_AND_INFO_ROW_GROUP_SIZE_FOR_IMAGE_DATASETS = 100
  35 PROCESSING_STEP_CONFIG_PARQUET_AND_INFO_ROW_GROUP_SIZE_FOR_BINARY_DATASETS = 100
  36 PARQUET_REVISION = "refs/convert/parquet"
  37 
  38 ERROR_CODES_TO_RETRY = {
  39     "CreateCommitError",
  40     "ExternalServerError",
  41     "JobManagerCrashedError",
  42     "LockedDatasetTimeoutError",
  43     "StreamingRowsError",
  44 }
  45 
  46 EXTERNAL_DATASET_SCRIPT_PATTERN = "datasets_modules/datasets"
  47 
  48 # Arrays are not immutable, we have to take care of not modifying them
  49 # Anyway: in all this file, we allow constant reassignment (no use of Final)
  50 CONFIG_HAS_VIEWER_KINDS = ["config-size"]
  51 CONFIG_INFO_KINDS = ["config-info"]
  52 CONFIG_PARQUET_METADATA_KINDS = ["config-parquet-metadata"]
  53 CONFIG_PARQUET_AND_METADATA_KINDS = ["config-parquet", "config-parquet-metadata"]
  54 CONFIG_SPLIT_NAMES_KINDS = ["config-split-names-from-info", "config-split-names-from-streaming"]
  55 DATASET_CONFIG_NAMES_KINDS = ["dataset-config-names"]
  56 DATASET_INFO_KINDS = ["dataset-info"]
  57 SPLIT_DUCKDB_INDEX_KINDS = ["split-duckdb-index"]
  58 SPLIT_HAS_PREVIEW_KINDS = ["split-first-rows-from-streaming", "split-first-rows-from-parquet"]
  59 SPLIT_HAS_SEARCH_KINDS = ["split-duckdb-index"]
  60 PARALLEL_STEPS_LISTS = [
  61     CONFIG_SPLIT_NAMES_KINDS,
  62     SPLIT_HAS_PREVIEW_KINDS,
  63 ]
  64 
  65 CROISSANT_MAX_CONFIGS = 100
  66 MAX_NUM_ROWS_PER_PAGE = 100
  67
  [end of libs/libcommon/src/libcommon/constants.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/libs/libcommon/src/libcommon/constants.py b/libs/libcommon/src/libcommon/constants.py
  --- a/libs/libcommon/src/libcommon/constants.py
  +++ b/libs/libcommon/src/libcommon/constants.py
  @@ -36,6 +36,7 @@
   PARQUET_REVISION = "refs/convert/parquet"
   
   ERROR_CODES_TO_RETRY = {
  +    "ConnectionError",
       "CreateCommitError",
       "ExternalServerError",
       "JobManagerCrashedError",
  
verification_info: {"golden_diff": "diff --git a/libs/libcommon/src/libcommon/constants.py b/libs/libcommon/src/libcommon/constants.py\n--- a/libs/libcommon/src/libcommon/constants.py\n+++ b/libs/libcommon/src/libcommon/constants.py\n@@ -36,6 +36,7 @@\n PARQUET_REVISION = \"refs/convert/parquet\"\n \n ERROR_CODES_TO_RETRY = {\n+    \"ConnectionError\",\n     \"CreateCommitError\",\n     \"ExternalServerError\",\n     \"JobManagerCrashedError\",\n", "issue": "Retry jobs that finish with `ClientConnection` error?\nMaybe here: https://github.com/huggingface/datasets-server/blob/f311a9212aaa91dd0373e5c2d4f5da9b6bdabcb5/chart/env/prod.yaml#L209\r\n\r\nInternal conversation on Slack: https://huggingface.slack.com/archives/C0311GZ7R6K/p1698224875005729\r\n\r\nAnyway: I'm wondering if we can have the error now that the dataset scripts are disabled by default.\n", "before_files": [{"content": "# SPDX-License-Identifier: Apache-2.0\n# Copyright 2022 The HuggingFace Authors.\n\nCACHE_COLLECTION_RESPONSES = \"cachedResponsesBlue\"\nCACHE_MONGOENGINE_ALIAS = \"cache\"\nHF_DATASETS_CACHE_APPNAME = \"hf_datasets_cache\"\nPARQUET_METADATA_CACHE_APPNAME = \"datasets_server_parquet_metadata\"\nDESCRIPTIVE_STATISTICS_CACHE_APPNAME = \"datasets_server_descriptive_statistics\"\nDUCKDB_INDEX_CACHE_APPNAME = \"datasets_server_duckdb_index\"\nDUCKDB_INDEX_DOWNLOADS_SUBDIRECTORY = \"downloads\"\nDUCKDB_INDEX_JOB_RUNNER_SUBDIRECTORY = \"job_runner\"\nCACHE_METRICS_COLLECTION = \"cacheTotalMetric\"\nQUEUE_METRICS_COLLECTION = \"jobTotalMetric\"\nMETRICS_MONGOENGINE_ALIAS = \"metrics\"\nQUEUE_COLLECTION_JOBS = \"jobsBlue\"\nQUEUE_COLLECTION_LOCKS = \"locks\"\nQUEUE_MONGOENGINE_ALIAS = \"queue\"\nQUEUE_TTL_SECONDS = 600  # 10 minutes\nLOCK_TTL_SECONDS_NO_OWNER = 600  # 10 minutes\nLOCK_TTL_SECONDS_TO_START_JOB = 600  # 10 minutes\nLOCK_TTL_SECONDS_TO_WRITE_ON_GIT_BRANCH = 3600  # 1 hour\n\nMAX_FAILED_RUNS = 3\nDATASET_SEPARATOR = \"--\"\nDEFAULT_DIFFICULTY = 50\nDEFAULT_DIFFICULTY_MAX = 100\nDEFAULT_DIFFICULTY_MIN = 0\nDEFAULT_INPUT_TYPE = \"dataset\"\nDEFAULT_JOB_RUNNER_VERSION = 1\nDIFFICULTY_BONUS_BY_FAILED_RUNS = 20\nMIN_BYTES_FOR_BONUS_DIFFICULTY = 3_000_000_000\n\nPROCESSING_STEP_CONFIG_PARQUET_AND_INFO_ROW_GROUP_SIZE_FOR_AUDIO_DATASETS = 100\nPROCESSING_STEP_CONFIG_PARQUET_AND_INFO_ROW_GROUP_SIZE_FOR_IMAGE_DATASETS = 100\nPROCESSING_STEP_CONFIG_PARQUET_AND_INFO_ROW_GROUP_SIZE_FOR_BINARY_DATASETS = 100\nPARQUET_REVISION = \"refs/convert/parquet\"\n\nERROR_CODES_TO_RETRY = {\n    \"CreateCommitError\",\n    \"ExternalServerError\",\n    \"JobManagerCrashedError\",\n    \"LockedDatasetTimeoutError\",\n    \"StreamingRowsError\",\n}\n\nEXTERNAL_DATASET_SCRIPT_PATTERN = \"datasets_modules/datasets\"\n\n# Arrays are not immutable, we have to take care of not modifying them\n# Anyway: in all this file, we allow constant reassignment (no use of Final)\nCONFIG_HAS_VIEWER_KINDS = [\"config-size\"]\nCONFIG_INFO_KINDS = [\"config-info\"]\nCONFIG_PARQUET_METADATA_KINDS = [\"config-parquet-metadata\"]\nCONFIG_PARQUET_AND_METADATA_KINDS = [\"config-parquet\", \"config-parquet-metadata\"]\nCONFIG_SPLIT_NAMES_KINDS = [\"config-split-names-from-info\", \"config-split-names-from-streaming\"]\nDATASET_CONFIG_NAMES_KINDS = [\"dataset-config-names\"]\nDATASET_INFO_KINDS = [\"dataset-info\"]\nSPLIT_DUCKDB_INDEX_KINDS = [\"split-duckdb-index\"]\nSPLIT_HAS_PREVIEW_KINDS = [\"split-first-rows-from-streaming\", \"split-first-rows-from-parquet\"]\nSPLIT_HAS_SEARCH_KINDS = [\"split-duckdb-index\"]\nPARALLEL_STEPS_LISTS = [\n    CONFIG_SPLIT_NAMES_KINDS,\n    SPLIT_HAS_PREVIEW_KINDS,\n]\n\nCROISSANT_MAX_CONFIGS = 100\nMAX_NUM_ROWS_PER_PAGE = 100\n", "path": "libs/libcommon/src/libcommon/constants.py"}]}