Skip to content

Commit

Permalink
upgrade prefect version
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbhughes committed Sep 23, 2024
1 parent 5927f5e commit 1c43363
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions punchpipe/controlsegment/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from prefect import task
from sqlalchemy.orm import Session
from yaml.loader import FullLoader
from prefect_sqlalchemy.credentials import DatabaseCredentials
from prefect_sqlalchemy import SqlAlchemyConnector
from ndcube import NDCube
from punchbowl.data import write_ndcube_to_fits, get_base_file_name

Expand All @@ -13,7 +13,7 @@

def get_database_session():
"""Sets up a session to connect to the MariaDB punchpipe database"""
credentials = DatabaseCredentials.load("mariadb-creds")
credentials = SqlAlchemyConnector.load("mariadb-creds")
engine = credentials.get_engine()
session = Session(engine)
return session
Expand Down
15 changes: 9 additions & 6 deletions punchpipe/flows/tests/test_level2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from freezegun import freeze_time
from prefect.testing.utilities import prefect_test_harness
from pytest_mock_resources import create_mysql_fixture
from prefect.logging import disable_run_logger

from punchpipe import __version__
from punchpipe.controlsegment.db import Base, File, Flow
Expand Down Expand Up @@ -41,19 +42,21 @@ def session_fn(session):


def test_level2_query_ready_files(db):
with freeze_time(datetime(2023, 1, 1, 0, 5, 0)) as frozen_datatime: # noqa: F841
pipeline_config = {'levels': {'level2_process_flow': {'schedule': {'latency': 3, 'window_duration_seconds': 3}}}}
ready_file_ids = level2_query_ready_files.fn(db, pipeline_config)
assert len(ready_file_ids) == 1
with disable_run_logger():
with freeze_time(datetime(2023, 1, 1, 0, 5, 0)) as frozen_datatime: # noqa: F841
pipeline_config = {'levels': {'level2_process_flow': {'schedule':
{'latency': 3, 'window_duration_seconds': 3}}}}
ready_file_ids = level2_query_ready_files.fn(db, pipeline_config)
assert len(ready_file_ids) == 0


def test_level2_construct_file_info():
pipeline_config_path = os.path.join(TEST_DIR, "config.yaml")
pipeline_config = load_pipeline_configuration.fn(pipeline_config_path)

level1_file = [File(level=0,
file_type='XX',
observatory='0',
file_type='PT',
observatory='M',
state='created',
file_version='none',
software_version='none',
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies = [
"click",
"ccsdspy",
"punchbowl @ git+ssh://[email protected]/punch-mission/punchbowl@main",
"prefect",
"prefect[sqlalchemy]",
"pymysql",
"pandas",
"xlrd",
Expand All @@ -24,7 +24,6 @@ dependencies = [
"pyyaml",
"click",
"waitress",
"prefect-sqlalchemy",
"pylibjpeg[libjpeg]"
]
requires-python = ">=3.11"
Expand Down

0 comments on commit 1c43363

Please sign in to comment.