Skip to content

Commit

Permalink
squash
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Mar 13, 2024
1 parent 27212f5 commit 32cfd0c
Show file tree
Hide file tree
Showing 41 changed files with 902 additions and 699 deletions.
28 changes: 28 additions & 0 deletions .github/actions/send_failure/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Send failure event to Datadog"
inputs:
api-key:
description: "Datadog API key"
required: true
title:
description: "Custom title for the event"
required: true
runs:
using: "composite"
steps:
- uses: masci/datadog@v1
with:
api-key: ${{ inputs.api-key }}
api-url: https://api.datadoghq.eu
events: |
- title: "${{ inputs.title }}"
text: "Job ${{ github.job }} in branch ${{ github.ref_name }}"
alert_type: "error"
source_type_name: "Github"
host: ${{ github.repository_owner }}
tags:
- "project:${{ github.repository }}"
- "job:${{ github.job }}"
- "run_id:${{ github.run_id }}"
- "workflow:${{ github.workflow }}"
- "branch:${{ github.ref_name }}"
- "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
9 changes: 8 additions & 1 deletion .github/workflows/astra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,11 @@ jobs:
env:
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_API_ENDPOINT }}
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_TOKEN }}
run: hatch run cov
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/chroma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/cohere.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/deepeval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
13 changes: 13 additions & 0 deletions .github/workflows/fastembed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,16 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}

- name: Nightly - run unit tests with Haystack main branch
if: github.ref_name == 'nightly-haystack-main'
run: |
hatch run "pip install git+https://github.com/deepset-ai/haystack.git"
hatch run test -m "not integration"
7 changes: 7 additions & 0 deletions .github/workflows/google_ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/google_vertex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
9 changes: 8 additions & 1 deletion .github/workflows/gradient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,11 @@ jobs:
run: hatch run docs

- name: Run tests
run: hatch run cov
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/instructor_embedders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/jina.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/llama_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/mistral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/mongodb_atlas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ jobs:
- name: Run tests
working-directory: integrations/mongodb_atlas
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/nvidia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/ollama.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ jobs:
- name: Run tests
working-directory: integrations/opensearch
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/optimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/pgvector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/pinecone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ jobs:
- name: Run tests
working-directory: integrations/pinecone
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/qdrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/ragas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/unstructured.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/uptrain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/weaviate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ jobs:

- name: Run tests
run: hatch run cov

- name: Send event to Datadog for nightly failures
if: github.event_name == 'schedule' && failure()
uses: ./.github/actions/send_failure
with:
title: "core-integrations nightly failure: ${{ github.workflow }}"
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
58 changes: 30 additions & 28 deletions integrations/elasticsearch/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,36 @@
from haystack_integrations.document_stores.elasticsearch import ElasticsearchDocumentStore


@patch("haystack_integrations.document_stores.elasticsearch.document_store.Elasticsearch")
def test_to_dict(_mock_elasticsearch_client):
document_store = ElasticsearchDocumentStore(hosts="some hosts")
res = document_store.to_dict()
assert res == {
"type": "haystack_integrations.document_stores.elasticsearch.document_store.ElasticsearchDocumentStore",
"init_parameters": {
"hosts": "some hosts",
"index": "default",
"embedding_similarity_function": "cosine",
},
}


@patch("haystack_integrations.document_stores.elasticsearch.document_store.Elasticsearch")
def test_from_dict(_mock_elasticsearch_client):
data = {
"type": "haystack_integrations.document_stores.elasticsearch.document_store.ElasticsearchDocumentStore",
"init_parameters": {
"hosts": "some hosts",
"index": "default",
"embedding_similarity_function": "cosine",
},
}
document_store = ElasticsearchDocumentStore.from_dict(data)
assert document_store._hosts == "some hosts"
assert document_store._index == "default"
assert document_store._embedding_similarity_function == "cosine"


@pytest.mark.integration
class TestDocumentStore(DocumentStoreBaseTests):
"""
Expand Down Expand Up @@ -67,34 +97,6 @@ def assert_documents_are_equal(self, received: List[Document], expected: List[Do

super().assert_documents_are_equal(received, expected)

@patch("haystack_integrations.document_stores.elasticsearch.document_store.Elasticsearch")
def test_to_dict(self, _mock_elasticsearch_client):
document_store = ElasticsearchDocumentStore(hosts="some hosts")
res = document_store.to_dict()
assert res == {
"type": "haystack_integrations.document_stores.elasticsearch.document_store.ElasticsearchDocumentStore",
"init_parameters": {
"hosts": "some hosts",
"index": "default",
"embedding_similarity_function": "cosine",
},
}

@patch("haystack_integrations.document_stores.elasticsearch.document_store.Elasticsearch")
def test_from_dict(self, _mock_elasticsearch_client):
data = {
"type": "haystack_integrations.document_stores.elasticsearch.document_store.ElasticsearchDocumentStore",
"init_parameters": {
"hosts": "some hosts",
"index": "default",
"embedding_similarity_function": "cosine",
},
}
document_store = ElasticsearchDocumentStore.from_dict(data)
assert document_store._hosts == "some hosts"
assert document_store._index == "default"
assert document_store._embedding_similarity_function == "cosine"

def test_user_agent_header(self, document_store: ElasticsearchDocumentStore):
assert document_store._client._headers["user-agent"].startswith("haystack-py-ds/")

Expand Down
Loading

0 comments on commit 32cfd0c

Please sign in to comment.