Skip to content

Commit

Permalink
Revert "ET-5231 Update image generation for unified WebApi (#1116)" (#…
Browse files Browse the repository at this point in the history
…1117)

This reverts commit 4c868ba.

Co-authored-by: Lucas Jenss <lucas.jenss.external@xayn.com>
  • Loading branch information
x3ro and Lucas Jenss authored Dec 6, 2023
1 parent 4c868ba commit 2fb8715
Show file tree
Hide file tree
Showing 44 changed files with 435 additions and 300 deletions.
43 changes: 32 additions & 11 deletions .github/workflows/web-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ env:
DENY_WARNINGS: false
runtime_name: ort
runtime_version: v1.15.1
web_api_archive: web-service-api
frontoffice_archive: web-service-frontoffice
backoffice_archive: web-service-backoffice

jobs:
services-build:
Expand Down Expand Up @@ -74,12 +75,21 @@ jobs:
${{ inputs.model_name }} ${{ inputs.model_version }} \
${{ env.runtime_name }} ${{ env.runtime_version }}

- name: Create web-api artifact
- name: Create backoffice artifact
uses: ./.github/actions/release_artifact
with:
platform: ${{ inputs.platform }}
bin_name: "web-api"
archive_name: ${{ env.web_api_archive }}
bin_name: "ingestion"
archive_name: ${{ env.backoffice_archive }}
model_full_name: ${{ inputs.model_name }}_${{ inputs.model_version }}
runtime_full_name: ${{ env.runtime_name }}_${{ env.runtime_version }}

- name: Create frontoffice artifact
uses: ./.github/actions/release_artifact
with:
platform: ${{ inputs.platform }}
bin_name: "personalization"
archive_name: ${{ env.frontoffice_archive }}
model_full_name: ${{ inputs.model_name }}_${{ inputs.model_version }}
runtime_full_name: ${{ env.runtime_name }}_${{ env.runtime_version }}

Expand Down Expand Up @@ -110,20 +120,30 @@ jobs:
TAG="$TAG-${{ inputs.model_name }}_${{ inputs.model_version }}"
TAG="$TAG-${{ inputs.platform }}"
fi
webapi_image_name="xaynetci/xayn_discovery_web_service:$TAG"
echo "webapi_image_name=$webapi_image_name" >> $GITHUB_ENV
frontoffice_image_name="xaynetci/xayn_discovery_web_service:$TAG"
backoffice_image_name="xaynetci/xayn_discovery_ingestion_service:$TAG"
echo "frontoffice_image_name=$frontoffice_image_name" >> $GITHUB_ENV
echo "backoffice_image_name=$backoffice_image_name" >> $GITHUB_ENV
cat <<EOT >>${GITHUB_STEP_SUMMARY}
# Image names
WebApi: $webapi_image_name
Back-office: $frontoffice_image_name
Front-office: $backoffice_image_name
EOT
- name: Create web API docker image
- name: Create backoffice docker image
uses: ./.github/actions/release_image
with:
archive_name: ${{ env.backoffice_archive }}
image_name: ${{ env.backoffice_image_name }}
platform: ${{ inputs.platform }}

- name: Create frontoffice docker image
uses: ./.github/actions/release_image
with:
archive_name: ${{ env.web_api_archive }}
image_name: ${{ env.webapi_image_name }}
archive_name: ${{ env.frontoffice_archive }}
image_name: ${{ env.frontoffice_image_name }}
platform: ${{ inputs.platform }}

- name: Login to Docker Hub
Expand All @@ -135,4 +155,5 @@ jobs:
- name: Push images
run: |
set -eux
docker push ${{ env.webapi_image_name }}
docker push ${{ env.frontoffice_image_name }}
docker push ${{ env.backoffice_image_name }}
4 changes: 2 additions & 2 deletions integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use tracing_subscriber::{
Layer,
};
use xayn_test_utils::{asset::ort_target, env::clear_env, workspace::find_workspace_dir};
use xayn_web_api::{config, start, AppHandle, Application, WebApi};
use xayn_web_api::{config, start, AppHandle, Application, Ingestion};
use xayn_web_api_db_ctrl::{Silo, Tenant};
use xayn_web_api_shared::{
elastic,
Expand Down Expand Up @@ -723,7 +723,7 @@ pub fn build_test_config_from_parts_and_names(
},
);

if app_name == WebApi::NAME {
if app_name == Ingestion::NAME {
let python_workspace = workspace.join("./snippet-extractor").display().to_string();
let tokenizer = model_dir.join("tokenizer.json").display().to_string();
let limit_to_two_threads = (num_cpus::get() as f32).recip() * 2.;
Expand Down
16 changes: 8 additions & 8 deletions integration-tests/tests/document_candidates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use reqwest::{Client, StatusCode, Url};
use serde::Deserialize;
use serde_json::{json, Value};
use xayn_integration_tests::{send_assert, send_assert_json, test_app, UNCHANGED_CONFIG};
use xayn_web_api::WebApi;
use xayn_web_api::Ingestion;

async fn ingest(client: &Client, url: &Url) -> Result<(), Error> {
send_assert(
Expand Down Expand Up @@ -72,7 +72,7 @@ async fn set(client: &Client, url: &Url, ids: impl IntoIterator<Item = &str>) ->

#[test]
fn test_candidates_all() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
assert!(get(&client, &url).await?.ids().is_empty());
ingest(&client, &url).await?;
assert_eq!(get(&client, &url).await?.ids(), ["d1", "d2", "d3"].into());
Expand All @@ -84,7 +84,7 @@ fn test_candidates_all() {

#[test]
fn test_candidates_some() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
assert!(get(&client, &url).await?.ids().is_empty());
ingest(&client, &url).await?;
assert_eq!(get(&client, &url).await?.ids(), ["d1", "d2", "d3"].into());
Expand All @@ -96,7 +96,7 @@ fn test_candidates_some() {

#[test]
fn test_candidates_none() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
assert!(get(&client, &url).await?.ids().is_empty());
ingest(&client, &url).await?;
assert_eq!(get(&client, &url).await?.ids(), ["d1", "d2", "d3"].into());
Expand All @@ -108,7 +108,7 @@ fn test_candidates_none() {

#[test]
fn test_candidates_not_default() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
assert!(get(&client, &url).await?.ids().is_empty());
send_assert(
&client,
Expand Down Expand Up @@ -154,7 +154,7 @@ struct ServerError {

#[test]
fn test_candidates_warning() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
assert!(get(&client, &url).await?.ids().is_empty());
ingest(&client, &url).await?;
assert_eq!(get(&client, &url).await?.ids(), ["d1", "d2", "d3"].into());
Expand Down Expand Up @@ -182,7 +182,7 @@ fn test_candidates_warning() {

#[test]
fn test_candidates_reingestion() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
assert!(get(&client, &url).await?.ids().is_empty());
send_assert(
&client,
Expand Down Expand Up @@ -254,7 +254,7 @@ fn test_deprecated_candidates() {
Ok(())
}

test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
deprecated_candidates(&client, &url, "/candidates").await?;
deprecated_candidates(&client, &url, "/documents/candidates").await?;

Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/document_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use reqwest::StatusCode;
use serde::Deserialize;
use serde_json::{json, Value};
use xayn_integration_tests::{send_assert, send_assert_json, test_app, UNCHANGED_CONFIG};
use xayn_web_api::WebApi;
use xayn_web_api::Ingestion;

#[derive(Debug, Deserialize)]
struct DocumentPropertiesResponse {
Expand All @@ -33,7 +33,7 @@ enum Error {
}

fn document_properties(is_candidate: bool) {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
send_assert(
&client,
client
Expand Down Expand Up @@ -151,7 +151,7 @@ struct DocumentPropertyResponse {
}

fn document_property(is_candidate: bool) {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |client, url, _| async move {
send_assert(
&client,
client
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/elastic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use serde_json::{json, Value};
use xayn_integration_tests::{test_app, TEST_EMBEDDING_SIZE, UNCHANGED_CONFIG};
use xayn_test_utils::assert_approx_eq;
use xayn_web_api::WebApi;
use xayn_web_api::Ingestion;
use xayn_web_api_shared::{
elastic::{BulkInstruction, Error, SerdeDiscard},
serde::json_object,
Expand All @@ -32,7 +32,7 @@ fn emb(emb: &[f32]) -> Result<Value, serde_json::Error> {
// just to be sure that the behavior hasn't changed
#[test]
fn test_normalized_es_knn_scores() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |_, _, services| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |_, _, services| async move {
let client = services
.silo
.elastic_client()
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/et_4957_es_deletion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use xayn_integration_tests::{
Services,
UNCHANGED_CONFIG,
};
use xayn_web_api::WebApi;
use xayn_web_api::{Ingestion, Personalization};
use xayn_web_api_shared::json_object;

async fn get_candidates(client: &Client, url: &Url) -> Result<HashSet<String>, Error> {
Expand Down Expand Up @@ -216,7 +216,7 @@ fn string_set(x: impl IntoIterator<Item = impl Into<String>>) -> HashSet<String>

#[test]
fn test_deletes_them_from_elastic_search() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, services| async move {
Expand Down Expand Up @@ -332,7 +332,7 @@ fn test_deletes_them_from_elastic_search() {

#[test]
fn test_deletes_them_from_elastic_search_2() {
test_app::<WebApi, _>(
test_app::<Ingestion, _>(
UNCHANGED_CONFIG,
|client, ingestion_url, services| async move {
ingest(
Expand Down
20 changes: 10 additions & 10 deletions integration-tests/tests/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use reqwest::{Client, StatusCode, Url};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use xayn_integration_tests::{send_assert, send_assert_json, test_two_apps, UNCHANGED_CONFIG};
use xayn_web_api::WebApi;
use xayn_web_api::{Ingestion, Personalization};

#[derive(Serialize)]
struct IngestedDocument {
Expand Down Expand Up @@ -93,7 +93,7 @@ struct BadRequest {

#[test]
fn test_filter_boolean() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -178,7 +178,7 @@ fn test_filter_boolean() {

#[test]
fn test_filter_keyword() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -263,7 +263,7 @@ fn test_filter_keyword() {

#[test]
fn test_filter_keyword_array_single() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -378,7 +378,7 @@ fn test_filter_keyword_array_single() {

#[test]
fn test_filter_keyword_array_multiple() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -509,7 +509,7 @@ fn test_filter_keyword_array_multiple() {

#[test]
fn test_filter_combine() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -677,7 +677,7 @@ fn test_filter_combine() {

#[test]
fn test_filter_number() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -783,7 +783,7 @@ fn test_filter_number() {

#[test]
fn test_filter_date() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -897,7 +897,7 @@ fn test_filter_date() {

#[test]
fn test_filter_no_value() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down Expand Up @@ -1004,7 +1004,7 @@ fn test_filter_no_value() {

#[test]
fn test_deprecated_published_after() {
test_two_apps::<WebApi, WebApi, _>(
test_two_apps::<Ingestion, Personalization, _>(
UNCHANGED_CONFIG,
UNCHANGED_CONFIG,
|client, ingestion_url, personalization_url, _| async move {
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ use std::time::Duration;

use reqwest::{Client, StatusCode};
use xayn_integration_tests::{send_assert, test_app, UNCHANGED_CONFIG};
use xayn_web_api::WebApi;
use xayn_web_api::Ingestion;

#[test]
fn test_health() {
test_app::<WebApi, _>(UNCHANGED_CONFIG, |_client, url, _| async move {
test_app::<Ingestion, _>(UNCHANGED_CONFIG, |_client, url, _| async move {
// make sure not to use any presets from `test_app`, like e.g. the
// X-Xayn-Tenant-Id header.
let client = Client::builder()
Expand Down
Loading

0 comments on commit 2fb8715

Please sign in to comment.