From 642711b534a2e918b5199b09ea45a63742a1978e Mon Sep 17 00:00:00 2001 From: Dave McKay Date: Tue, 25 Jun 2024 13:40:11 +0100 Subject: [PATCH] added entrypoint --- echo-side/containers/basic_env/Dockerfile | 6 ++++- echo-side/dags/monitor.py | 28 +++++++++++------------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/echo-side/containers/basic_env/Dockerfile b/echo-side/containers/basic_env/Dockerfile index a5461b5..235e813 100644 --- a/echo-side/containers/basic_env/Dockerfile +++ b/echo-side/containers/basic_env/Dockerfile @@ -8,8 +8,12 @@ RUN conda install -y -c conda-forge mamba && mamba init COPY environment.yaml /environment.yaml -RUN mamba env update --file /environment.yaml +RUN mamba env create --name lsst-uk --file=/environment.yaml RUN git clone https://github.com/lsst-uk/csd3-echo-somerville.git RUN cd csd3-echo-somerville && python -m pip install . + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/echo-side/dags/monitor.py b/echo-side/dags/monitor.py index 9249f4c..af171f4 100644 --- a/echo-side/dags/monitor.py +++ b/echo-side/dags/monitor.py @@ -17,7 +17,7 @@ def run_on_new_file(**kwargs): s3_hook = S3Hook(aws_conn_id='EchoS3') - bucket_name='LSST-IR-FUSION-TESTCOLLATE', + bucket_name='LSST-IR-FUSION-TESTSTRATEGY', bucket_key='/', wildcard_match_suffix='.csv', all_keys = s3_hook.list_keys(bucket_name=bucket_name, prefix=bucket_key, delimiter='/', suffix=wildcard_match_suffix, apply_wildcard=True), @@ -34,15 +34,15 @@ def run_on_new_file(**kwargs): } dag = DAG( - 'monitor-LSST-IR-FUSION-TESTCOLLATE', + 'monitor-LSST-IR-FUSION-TESTSTRATEGY', default_args=default_args, - description='Monitor LSST-IR-FUSION-TESTCOLLATE S3 bucket for new CSV-formatted upload log files.', + description='Monitor LSST-IR-FUSION-TESTSTRATEGY S3 bucket for new CSV-formatted upload log files.', schedule=timedelta(days=1), ) s3_sensor = S3KeySensor( task_id='s3_sensor', - bucket_name='LSST-IR-FUSION-TESTCOLLATE', + bucket_name='LSST-IR-FUSION-TESTSTRATEGY', bucket_key='*.csv', wildcard_match=True, aws_conn_id='EchoS3', @@ -60,16 +60,16 @@ def run_on_new_file(**kwargs): op_kwargs={'ds': '{{ ds }}'}, ) -# check_csv = KubernetesPodOperator( -# task_id="check_key", -# name="check-key", -# namespace="airflow", -# image="localhost:32000/check-csv:latest", -# cmds=["python", "-c"], -# arguments=[new_keys],#,connection.get_credentials()access_key,connection.secret_key], -# get_logs=True, -# dag=dag, -# ) +check_csv = KubernetesPodOperator( + task_id="check_key", + name="check-key", + namespace="airflow", + image="ghcr.io/lsst-uk/csd3-echo-somerville:latest", + cmds=["python", "-c"], + arguments=[new_keys],#,connection.get_credentials()access_key,connection.secret_key], + get_logs=True, + dag=dag, +) #graph s3_sensor >> run_on_new_file_op