Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BUG-433: Fix pipeline general asset error #439

Open
wants to merge 21 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 262 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
name: Run Tests

on:
push:
branches:
- test
pull_request:
branches:
- test
workflow_dispatch:

jobs:
test-general-assets:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run general_assets
run: python -m pytest tests/functional/general_assets

test-file-asset:
runs-on: ubuntu-latest
needs: test-general-assets
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run File Asset
run: python -m pytest tests/functional/file_asset

test-agent:
runs-on: ubuntu-latest
needs: test-file-asset
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run Agent
run: python -m pytest tests/functional/agent

test-team-agent:
runs-on: ubuntu-latest
needs: test-agent
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run Team Agent
run: python -m pytest tests/functional/team_agent

test-data-asset:
runs-on: ubuntu-latest
needs: test-team-agent
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run Data
run: python -m pytest tests/functional/data_asset

test-benchmark:
runs-on: ubuntu-latest
needs: test-data-asset
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run Benchmark
run: python -m pytest tests/functional/benchmark

test-pipelines:
runs-on: ubuntu-latest
needs: test-benchmark
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run Pipelines
run: python -m pytest tests/functional/pipelines

test-api-key:
runs-on: ubuntu-latest
needs: test-pipelines
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run Api Key
run: python -m pytest tests/functional/apikey

test-finetuner:
runs-on: ubuntu-latest
needs: test-api-key
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest

- name: Set environment variables
run: |
echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV
echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV
echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV
echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV

- name: Run Finetuner
run: python -m pytest tests/functional/finetune
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -21,5 +21,5 @@ repos:
rev: v2.0.0 # Use the latest version
hooks:
- id: flake8
args: # arguments to configure black
- --ignore=E402,E501
args: # arguments to configure flake8
- --ignore=E402,E501,E203
2 changes: 2 additions & 0 deletions aixplain/enums/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F401 // to ignore the F401 (unused import)
from .data_split import DataSplit
from .data_subtype import DataSubtype
from .data_type import DataType
@@ -14,3 +15,4 @@
from .sort_by import SortBy
from .sort_order import SortOrder
from .response_status import ResponseStatus
from .database_source import DatabaseSourceType
47 changes: 47 additions & 0 deletions aixplain/enums/database_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
__author__ = "aiXplain"

"""
Copyright 2024 The aiXplain SDK authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: Lucas Pavanelli and Thiago Castro Ferreira and Ahmet Gunduz
Date: March 7th 2025
Description:
Database Source Type Enum
"""

from enum import Enum


class DatabaseSourceType(Enum):
"""Enum for database source types"""

POSTGRESQL = "postgresql"
SQLITE = "sqlite"
CSV = "csv"

@classmethod
def from_string(cls, source_type: str) -> "DatabaseSourceType":
"""Convert string to DatabaseSourceType enum
Args:
source_type (str): Source type string
Returns:
DatabaseSourceType: Corresponding enum value
"""
try:
return cls[source_type.upper()]
except KeyError:
raise ValueError(f"Invalid source type: {source_type}")
8 changes: 8 additions & 0 deletions aixplain/enums/status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum
from typing import Text


class Status(Text, Enum):
FAILED = "failed"
IN_PROGRESS = "in_progress"
SUCCESS = "success"
Loading
Loading