Skip to content

Commit

Permalink
fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
cakeinsauce committed May 2, 2024
1 parent 3660452 commit 06cda45
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ jobs:
poetry install --no-root
poetry add ../lib/filter_lib
poetry add ../lib/tenants
poetry run pytest
- name: Run linters and checkers [flake8 -> isort -> black]
working-directory: ./jobs
run: |
poetry run flake8 --exclude=alembic,tests --extend-ignore=E203
poetry run isort --profile=black --line-length=79 --check-only --skip=alembic --skip=tests .
poetry run black --check --line-length=79 --exclude="(alembic|tests)" .
poetry run flake8 --extend-ignore=E203 jobs/
poetry run isort --profile=black --line-length=79 --check-only jobs/
poetry run black --check --line-length=79 jobs
- name: Run tests
working-directory: ./jobs
run: |
Expand Down
13 changes: 7 additions & 6 deletions jobs/jobs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get_version() -> str:

return default


def get_service_uri(prefix: str) -> str: # noqa
service_scheme = os.getenv(f"{prefix}SERVICE_SCHEME")
service_host = os.getenv(f"{prefix}SERVICE_HOST")
Expand All @@ -42,13 +43,13 @@ def get_service_uri(prefix: str) -> str: # noqa
)

KEYCLOAK_HOST = os.environ.get("KEYCLOAK_HOST", "")
USERS_HOST = get_service_uri('USERS_')
USERS_HOST = get_service_uri("USERS_")

PIPELINES_SERVICE_HOST = get_service_uri('PIPELINES_')
ASSETS_SERVICE_HOST = get_service_uri('ASSETS_')
ANNOTATION_SERVICE_HOST = get_service_uri('ANNOTATION_')
TAXONOMY_SERVICE_HOST = get_service_uri('TAXONOMY_')
JOBS_SERVICE_HOST = get_service_uri('JOBS_')
PIPELINES_SERVICE_HOST = get_service_uri("PIPELINES_")
ASSETS_SERVICE_HOST = get_service_uri("ASSETS_")
ANNOTATION_SERVICE_HOST = get_service_uri("ANNOTATION_")
TAXONOMY_SERVICE_HOST = get_service_uri("TAXONOMY_")
JOBS_SERVICE_HOST = get_service_uri("JOBS_")

PAGINATION_THRESHOLD = 7
PROVIDE_JWT_IF_NO_ANY = True
4 changes: 2 additions & 2 deletions jobs/jobs/create_job_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def create_extraction_job(

pipeline_id = (
extraction_job_input.pipeline_name
if extraction_job_input.pipeline_name.endswith(':airflow')
if extraction_job_input.pipeline_name.endswith(":airflow")
else pipeline_instance.get("id")
)
pipeline_categories = pipeline_instance.get("meta", {}).get(
Expand Down Expand Up @@ -137,7 +137,7 @@ async def create_extraction_annotation_job(
)
pipeline_id = (
extraction_annotation_job_input.pipeline_name
if extraction_annotation_job_input.pipeline_name.endswith(':airflow')
if extraction_annotation_job_input.pipeline_name.endswith(":airflow")
else pipeline_instance.get("id")
)

Expand Down
2 changes: 1 addition & 1 deletion jobs/jobs/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import asyncio
import os
from typing import Any, Dict, List, Optional, Union

from fastapi import Depends, FastAPI, Header, HTTPException, status
Expand Down
4 changes: 3 additions & 1 deletion jobs/jobs/run_job_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ async def run_extraction_job(
"""Runs ExtractionJob - creates init_args
and sends it to the Pipeline Manager"""

if isinstance(job_to_run.pipeline_id, str) and not job_to_run.pipeline_id.endswith(':airflow'):
if isinstance(
job_to_run.pipeline_id, str
) and not job_to_run.pipeline_id.endswith(":airflow"):
raise HTTPException(
status_code=400,
detail="Wrong pipeline value.",
Expand Down
4 changes: 2 additions & 2 deletions jobs/jobs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from jobs.config import (
ANNOTATION_SERVICE_HOST,
ASSETS_SERVICE_HOST,
PIPELINES_SERVICE_HOST,
TAXONOMY_SERVICE_HOST,
JOBS_SERVICE_HOST,
PAGINATION_THRESHOLD,
PIPELINES_SERVICE_HOST,
ROOT_PATH,
TAXONOMY_SERVICE_HOST,
USERS_HOST,
)
from jobs.logger import logger
Expand Down

0 comments on commit 06cda45

Please sign in to comment.