Skip to content

Commit

Permalink
[fix](doris compose) fix docker py exception (apache#39976)
Browse files Browse the repository at this point in the history
```
Exception:
java.lang.Exception: Exit value: 1 != 0, stdout: {
    "code": 1,
    "err": "Traceback (most recent call last):\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/command.py\", line 336, in run\n    cluster = CLUSTER.Cluster.load(args.NAME)\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/cluster.py\", line 656, in load\n    raise Exception(\nException: Failed to load cluster, its directory /tmp/doris/test_coordidator_be_restart not exists.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.10/dist-packages/requests/adapters.py\", line 633, in send\n    conn = self.get_connection_with_tls_context(\n  File \"/usr/local/lib/python3.10/dist-packages/requests/adapters.py\", line 489, in get_connection_with_tls_context\n    conn = self.poolmanager.connection_from_host(\n  File \"/usr/lib/python3/dist-packages/urllib3/poolmanager.py\", line 245, in connection_from_host\n    return self.connection_from_context(request_context)\n  File \"/usr/lib/python3/dist-packages/urllib3/poolmanager.py\", line 257, in connection_from_context\n    raise URLSchemeUnknown(scheme)\nurllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+docker\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/lib/python3/dist-packages/docker/api/client.py\", line 214, in _retrieve_server_version\n    return self.version(api_version=False)[\"ApiVersion\"]\n  File \"/usr/lib/python3/dist-packages/docker/api/daemon.py\", line 181, in version\n    return self._result(self._get(url), json=True)\n  File \"/usr/lib/python3/dist-packages/docker/utils/decorators.py\", line 46, in inner\n    return f(self, *args, **kwargs)\n  File \"/usr/lib/python3/dist-packages/docker/api/client.py\", line 237, in _get\n    return self.get(url, **self._set_request_timeout(kwargs))\n  File \"/usr/local/lib/python3.10/dist-packages/requests/sessions.py\", line 602, in get\n    return self.request(\"GET\", url, **kwargs)\n  File \"/usr/local/lib/python3.10/dist-packages/requests/sessions.py\", line 589, in request\n    resp = self.send(prep, **send_kwargs)\n  File \"/usr/local/lib/python3.10/dist-packages/requests/sessions.py\", line 703, in send\n    r = adapter.send(request, **kwargs)\n  File \"/usr/local/lib/python3.10/dist-packages/requests/adapters.py\", line 637, in send\n    raise InvalidURL(e, request=request)\nrequests.exceptions.InvalidURL: Not supported URL scheme http+docker\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/doris-compose.py\", line 54, in <module>\n    data = run(args, disable_log, help)\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/doris-compose.py\", line 38, in run\n    result = cmd.run(args)\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/command.py\", line 386, in run\n    cluster = CLUSTER.Cluster.new(args.NAME, args.IMAGE, args.cloud,\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/cluster.py\", line 640, in new\n    subnet = gen_subnet_prefix16()\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/cluster.py\", line 87, in gen_subnet_prefix16\n    used_subnet = utils.get_docker_subnets_prefix16()\n  File \"/home/ubuntu/regression-test/doris_master/NEREIDS_ASAN/p0/docker/runtime/doris-compose/utils.py\", line 226, in get_docker_subnets_prefix16\n    client = docker.from_env()\n  File \"/usr/lib/python3/dist-packages/docker/client.py\", line 96, in from_env\n    return cls(\n  File \"/usr/lib/python3/dist-packages/docker/client.py\", line 45, in __init__\n    self.api = APIClient(*args, **kwargs)\n  File \"/usr/lib/python3/dist-packages/docker/api/client.py\", line 197, in __init__\n    self._version = self._retrieve_server_version()\n  File \"/usr/lib/python3/dist-packages/docker/api/client.py\", line 221, in _retrieve_server_version\n    raise DockerException(\ndocker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker\n"
}
, stderr: /usr/local/lib/python3.10/dist-packages/paramiko/pkey.py:100: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
  "cipher": algorithms.TripleDES,
/usr/local/lib/python3.10/dist-packages/paramiko/transport.py:258: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
  "class": algorithms.TripleDES,
  at org.apache.doris.regression.suite.SuiteCluster.runCmd(SuiteCluster.groovy:603)
```
  • Loading branch information
yujun777 authored Aug 28, 2024
1 parent d5c7b76 commit 8f533e9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
17 changes: 3 additions & 14 deletions docker/runtime/doris-compose/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,7 @@ ARG JDK_IMAGE=openjdk:17-jdk-slim

FROM ${JDK_IMAGE}

RUN <<EOF
if [ -d "/usr/local/openjdk-17" ]; then
ln -s /usr/local/openjdk-17 /usr/local/openjdk
else \
ln -s /usr/local/openjdk-8 /usr/local/openjdk
fi
EOF

# set environment variables
ENV JAVA_HOME="/usr/local/openjdk"
ENV JACOCO_VERSION 0.8.8

RUN mkdir -p /opt/apache-doris/coverage
Expand All @@ -58,12 +49,10 @@ RUN curl -f https://repo1.maven.org/maven2/org/jacoco/jacoco/${JACOCO_VERSION}/j

# cloud
COPY cloud/CMakeLists.txt cloud/output* output/ms* /opt/apache-doris/cloud/
RUN <<EOF
mkdir /opt/apache-doris/fdb
if [ -d /opt/apache-doris/cloud/bin ]; then
sed -i 's/\<chmod\>/echo/g' /opt/apache-doris/cloud/bin/start.sh
RUN mkdir /opt/apache-doris/fdb
RUN if [ -d /opt/apache-doris/cloud/bin ]; then \
sed -i 's/\<chmod\>/echo/g' /opt/apache-doris/cloud/bin/start.sh ; \
fi
EOF

# fe and be
COPY output /opt/apache-doris/
Expand Down
16 changes: 15 additions & 1 deletion docker/runtime/doris-compose/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,16 @@ def compose(self):
for path in ("/etc/localtime", "/etc/timezone",
"/usr/share/zoneinfo") if os.path.exists(path)
]

if self.cluster.coverage_dir:
volumes.append("{}:{}/coverage".format(self.cluster.coverage_dir,
DOCKER_DORIS_PATH))

extra_hosts = [
"{}:{}".format(node.get_name(), node.get_ip())
for node in self.cluster.get_all_nodes()
]

content = {
"cap_add": ["SYS_PTRACE"],
"hostname": self.get_name(),
Expand All @@ -357,6 +363,7 @@ def compose(self):
"ipv4_address": self.get_ip(),
}
},
"extra_hosts": extra_hosts,
"ports": self.docker_ports(),
"ulimits": {
"core": -1
Expand Down Expand Up @@ -699,7 +706,14 @@ def get_node(self, node_type, id):
raise Exception("No found {} with id {}".format(node_type, id))
return Node.new(self, node_type, id, meta)

def get_all_nodes(self, node_type):
def get_all_nodes(self, node_type=None):
if node_type is None:
nodes = []
for nt, group in self.groups.items():
for id, meta in group.get_all_nodes().items():
nodes.append(Node.new(self, nt, id, meta))
return nodes

group = self.groups.get(node_type, None)
if not group:
raise Exception("Unknown node_type: {}".format(node_type))
Expand Down
1 change: 1 addition & 0 deletions docker/runtime/doris-compose/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ jsonpickle
prettytable
pymysql
python-dateutil
requests<=2.31.0
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ class RegressionTest {
log.warn("install doris compose requirements failed: code=${proc.exitValue()}, "
+ "output: ${sout.toString()}, error: ${serr.toString()}")
}

def pipList = 'pip list'.execute().text
log.info("python library: ${pipList}")
}

static void printPassed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ class SuiteCluster {
}

private Object runCmd(String cmd, int timeoutSecond = 60) throws Exception {
def fullCmd = String.format('python %s %s --output-json', config.dorisComposePath, cmd)
def fullCmd = String.format('python -W ignore %s %s --output-json', config.dorisComposePath, cmd)
logger.info('Run doris compose cmd: {}', fullCmd)
def proc = fullCmd.execute()
def outBuf = new StringBuilder()
Expand Down

0 comments on commit 8f533e9

Please sign in to comment.