From a374dd4f6d37f42d4a6a6f08f2e1caec15e12b36 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Sun, 8 Oct 2023 23:28:43 +0900 Subject: [PATCH] resolve CI/`sudo` and minor code adjustments (#1698) --- .azure/gpu-special-tests.yml | 6 ------ .azure/template-examples.yml | 6 ------ src/flash/core/serve/dag/order.py | 2 +- src/flash/core/serve/dag/task.py | 2 +- src/flash/core/serve/dag/utils.py | 2 +- 5 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.azure/gpu-special-tests.yml b/.azure/gpu-special-tests.yml index 02b64bb12c..032e48b825 100644 --- a/.azure/gpu-special-tests.yml +++ b/.azure/gpu-special-tests.yml @@ -35,11 +35,6 @@ jobs: echo "##vso[task.setvariable variable=CONTAINER_ID]$(head -1 /proc/self/cgroup|cut -d/ -f3)" displayName: 'Set environment variables' - - script: | - /tmp/docker exec -t -u 0 $CONTAINER_ID \ - sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo" - displayName: 'Install Sudo in container (thanks Microsoft!)' - - bash: | echo $CUDA_VISIBLE_DEVICES lspci | egrep 'VGA|3D' @@ -56,7 +51,6 @@ jobs: displayName: 'Sanity check' - script: | - sudo apt-get install -y build-essential gcc cmake software-properties-common python -m pip install "pip==22.2.1" pip --version pip install '.[image,test]' -r requirements/testing_image.txt -U diff --git a/.azure/template-examples.yml b/.azure/template-examples.yml index 1d7a6b0e75..51aa25ac86 100644 --- a/.azure/template-examples.yml +++ b/.azure/template-examples.yml @@ -27,11 +27,6 @@ jobs: echo "##vso[task.setvariable variable=CONTAINER_ID]$(head -1 /proc/self/cgroup|cut -d/ -f3)" displayName: 'Set environment variables' - - script: | - /tmp/docker exec -t -u 0 $CONTAINER_ID \ - sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo" - displayName: 'Install Sudo in container (thanks Microsoft!)' - - bash: | echo $CUDA_VISIBLE_DEVICES lspci | egrep 'VGA|3D' @@ -47,7 +42,6 @@ jobs: displayName: 'Sanity check' - script: | - sudo apt-get install -y build-essential gcc cmake software-properties-common python -m pip install "pip==22.2.1" pip --version pip install '.[${{topic}},test]' -r "requirements/testing_${{topic}}.txt" -U --prefer-binary diff --git a/src/flash/core/serve/dag/order.py b/src/flash/core/serve/dag/order.py index 07dab3ed48..022696fd72 100644 --- a/src/flash/core/serve/dag/order.py +++ b/src/flash/core/serve/dag/order.py @@ -458,7 +458,7 @@ def finish_now_key(x): # If we have many tiny groups left, then it's best to simply iterate. if not is_init_sorted: prev_len = len(init_stack) - if type(init_stack) is dict: + if isinstance(init_stack, dict): init_stack = set(init_stack) init_stack = set_difference(init_stack, result) N = len(init_stack) diff --git a/src/flash/core/serve/dag/task.py b/src/flash/core/serve/dag/task.py index 57d49f7a67..51de4e2369 100644 --- a/src/flash/core/serve/dag/task.py +++ b/src/flash/core/serve/dag/task.py @@ -445,6 +445,6 @@ def quote(x): (literal,) """ - if istask(x) or type(x) is list or type(x) is dict: + if istask(x) or isinstance(x, (list, dict)): return (literal(x),) return x diff --git a/src/flash/core/serve/dag/utils.py b/src/flash/core/serve/dag/utils.py index 5c5f188fdb..78b4b363a3 100644 --- a/src/flash/core/serve/dag/utils.py +++ b/src/flash/core/serve/dag/utils.py @@ -72,7 +72,7 @@ def key_split(s): >>> key_split('_(x)') # strips unpleasant characters 'x' """ - if type(s) is bytes: + if isinstance(s, bytes): s = s.decode() if type(s) is tuple: s = s[0]