-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into registry-tracing-logging
- Loading branch information
Showing
13 changed files
with
84 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use std::time::Duration; | ||
|
||
use anyhow::bail; | ||
use lazy_static::lazy_static; | ||
use reqwest::{IntoUrl, Response}; | ||
|
||
lazy_static! { | ||
static ref CLIENT: reqwest::Client = reqwest::Client::new(); | ||
} | ||
|
||
pub async fn get_retry<U: IntoUrl>(url: U) -> anyhow::Result<Response> { | ||
let url = url.into_url()?; | ||
|
||
let max_retries = 5; | ||
let max_interval = Duration::from_secs(15); | ||
let mut interval = Duration::from_millis(500); | ||
|
||
for retry in 1..=max_retries { | ||
match CLIENT.get(url.clone()).send().await { | ||
Ok(resp) => { | ||
if resp.status().is_success() { | ||
return Ok(resp); | ||
} | ||
let err_msg = resp.text().await.unwrap_or_default(); | ||
eprintln!("Failed to GET {url}: {err_msg}. Attempt no. {retry}"); | ||
} | ||
Err(err) => { | ||
eprintln!("Network error on GET {url}: {err}. Attempt no. {retry}"); | ||
} | ||
} | ||
|
||
let jitter = Duration::from_millis(fastrand::u64(0..1500)); | ||
interval = std::cmp::min(interval * 2, max_interval); // Double the interval for exponential backoff | ||
|
||
tokio::time::sleep(interval + jitter).await; | ||
} | ||
|
||
bail!("Failed to GET {url} after {max_retries} retries."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
ARG PG_VERSION=15 | ||
FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.9.7 | ||
ARG PG_VERSION=16 | ||
FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.11.0 | ||
USER root | ||
# quay.io/coredb/pgrx-builder:pg15-pgrx0.9.7 | ||
|
||
ARG RELEASE=v2.7.13 | ||
ARG PG_VERSION=16 | ||
|
||
# Extension build dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
libreadline-dev \ | ||
zlib1g-dev \ | ||
flex \ | ||
bison \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
libssl-dev \ | ||
libxml2-utils \ | ||
xsltproc \ | ||
ccache \ | ||
python3-dev \ | ||
clang \ | ||
libopenblas-dev \ | ||
libssl-dev \ | ||
bison \ | ||
flex \ | ||
pkg-config \ | ||
cmake \ | ||
libreadline-dev \ | ||
libz-dev \ | ||
tzdata \ | ||
sudo \ | ||
libpq-dev \ | ||
libclang-dev \ | ||
libopenblas-dev \ | ||
postgresql-${PG_VERSION} \ | ||
postgresql-server-dev-${PG_VERSION} \ | ||
python3 \ | ||
python3-pip \ | ||
libpython3-dev \ | ||
pkg-config | ||
|
||
# Install Rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
lld | ||
|
||
# Set default Rust version | ||
RUN /root/.cargo/bin/rustup default stable | ||
RUN rustup default 1.78.0-x86_64-unknown-linux-gnu | ||
|
||
# Clone repository | ||
RUN git clone https://github.com/postgresml/postgresml.git | ||
|
||
ARG RELEASE=v2.7.1 | ||
|
||
# Build the extension | ||
RUN cd postgresml && \ | ||
git submodule update --init --recursive && \ | ||
git fetch origin ${RELEASE} && \ | ||
git checkout ${RELEASE} && \ | ||
cd pgml-extension && \ | ||
cargo pgrx init --pg15 /usr/bin/pg_config && \ | ||
cargo pgrx init --pg${PG_VERSION} /usr/bin/pg_config && \ | ||
cargo pgrx package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters