diff --git a/configs/docker/build/Dockerfile b/configs/docker/build/Dockerfile index 8957dd91f12b8f3fe472848af2e606b63551d017..d7a4f9b02200be202b0b48312e7eeed06894f1be 100644 --- a/configs/docker/build/Dockerfile +++ b/configs/docker/build/Dockerfile @@ -1,10 +1,13 @@ # syntax=docker/dockerfile:1 -FROM ubuntu:24.04 as base_image +FROM ubuntu:24.04 SHELL ["/bin/bash", "-c"] #install system packages -RUN apt-get update;apt-get install --assume-yes python3.11 python3.11-venv wget unzip emacs gdal-bin libgdal-dev build-essential gfortran zlib1g zlib1g-dev libbz2-dev apt-utils liblzma-dev libcurl4-openssl-dev default-jre openssh-server libfribidi-dev libfontconfig1-dev libspatialindex-dev git dos2unix nano rsync; +RUN apt-get update; +RUN apt-get install --assume-yes software-properties-common; +RUN add-apt-repository ppa:deadsnakes/ppa; +RUN apt-get install --assume-yes python3.11 python3.11-venv wget unzip emacs gdal-bin libgdal-dev build-essential gfortran zlib1g zlib1g-dev libbz2-dev apt-utils liblzma-dev libcurl4-openssl-dev default-jre openssh-server libfribidi-dev libfontconfig1-dev libspatialindex-dev git dos2unix nano rsync; RUN echo "alias e='emacs -nw $1'" >> ~/.bashrc; RUN alias ll="ls -ltr" diff --git a/configs/docker/build/requirements.txt b/configs/docker/build/requirements.txt index 53515092414e7016f02afce415059575be54e81e..756d5edd917df8a9fe81cacd178607843b8ae1fa 100644 --- a/configs/docker/build/requirements.txt +++ b/configs/docker/build/requirements.txt @@ -9,4 +9,4 @@ HTMLTestRunner-rv==1.1.2 python-docx==1.1.0 rioxarray==0.15.0 Rtree==1.1.0 -scikit-learn==1.4.0 \ No newline at end of file +scikit-learn==1.4.0 diff --git a/configs/docker/run/launchAndRunDockerEWS.sh b/configs/docker/run/launchAndRunDockerEWS.sh index 9cca8b74fd81eecc090d2f2cd4b8be8668783431..dbc0866e3a66a1fcac3971099d111214bc29d086 100755 --- a/configs/docker/run/launchAndRunDockerEWS.sh +++ b/configs/docker/run/launchAndRunDockerEWS.sh @@ -75,7 +75,7 @@ elif [ "$component" = "Survey" ];then elif [ "$component" = "Advisory" ];then component_script="/storage/app/EWS_prod/code/coordinator/scripts/run_Advisory_Processor.sh" elif [ "$component" = "Scraper" ];then - component_script="/storage/app/EWS_prod/code/coordinator/scripts/run_Environment_Processor.sh" + component_script="/storage/app/EWS_prod/code/coordinator/scripts/run_Scraper_Processor.sh" elif [ "$component" = "Epidemiology" ];then component_script="/storage/app/EWS_prod/code/coordinator/scripts/run_Epidemiology_Processor.sh" elif [ "$component" = "MetResample" ];then diff --git a/docs/_source/installation.rst b/docs/_source/installation.rst index 4b61d26ed81dcc2004148feaedbaeaed10e9b26c..38cd73b12bb8ffce2c8cac7864e61f02628cea62 100644 --- a/docs/_source/installation.rst +++ b/docs/_source/installation.rst @@ -30,8 +30,8 @@ In this example, we are using the Linux user “ewsmanager†and group “ews mkdir ./code; mkdir -p regions/EastAfrica/workspace; mkdir -p regions/SouthAsia/workspace; - mkdir -p regions/EastAfrica/resources; - mkdir -p regions/SouthAsia/resources; + mkdir -p regions/EastAfrica/resources/assets/; + mkdir -p regions/SouthAsia/resources/assets/; mkdir -p met_inputs/metofficeupload/upload/Ethiopia/toMO/; mkdir -p met_inputs/metofficeupload/upload/Ethiopia/fromMO/daily_name/; mkdir -p web_data/Ethiopia; @@ -43,11 +43,11 @@ In this example, we are using the Linux user “ewsmanager†and group “ews .. code-block:: bash - mkdir -p ./code regions/EastAfrica/workspace regions/SouthAsia/workspace regions/EastAfrica/resources regions/SouthAsia/resources met_inputs/metofficeupload/upload/Ethiopia/toMO/ met_inputs/metofficeupload/upload/Ethiopia/fromMO/daily_name/ web_data/Ethiopia met_inputs/metofficeupload/upload/SouthAsia/toMO/ met_inputs/metofficeupload/upload/SouthAsia/fromMO/daily_name/ web_data/SouthAsia ./logs ./envs/credentials + mkdir -p ./code regions/EastAfrica/workspace regions/SouthAsia/workspace regions/EastAfrica/resources regions/EastAfrica/resources/assets regions/SouthAsia/resources regions/SouthAsia/resources/assets met_inputs/metofficeupload/upload/Ethiopia/toMO/ met_inputs/metofficeupload/upload/Ethiopia/fromMO/daily_name/ web_data/Ethiopia met_inputs/metofficeupload/upload/SouthAsia/toMO/ met_inputs/metofficeupload/upload/SouthAsia/fromMO/daily_name/ web_data/SouthAsia ./logs ./envs/credentials .. code-block:: bash - mkdir -p .\code regions\EastAfrica\workspace regions\SouthAsia\workspace regions\EastAfrica\resources regions\SouthAsia\resources met_inputs\metofficeupload\upload\Ethiopia\toMO\ met_inputs\metofficeupload\upload\Ethiopia\fromMO\daily_name\ web_data\Ethiopia met_inputs\metofficeupload\upload\SouthAsia\toMO\ met_inputs\metofficeupload\upload\SouthAsia\fromMO\daily_name\ web_data\SouthAsia .\logs .\envs\credentials + mkdir -p .\code regions\EastAfrica\workspace regions\SouthAsia\workspace regions\EastAfrica\resources regions\EastAfrica\resources\assets regions\SouthAsia\resources regions\SouthAsia\resources\assets met_inputs\metofficeupload\upload\Ethiopia\toMO\ met_inputs\metofficeupload\upload\Ethiopia\fromMO\daily_name\ web_data\Ethiopia met_inputs\metofficeupload\upload\SouthAsia\toMO\ met_inputs\metofficeupload\upload\SouthAsia\fromMO\daily_name\ web_data\SouthAsia .\logs .\envs\credentials shell scripts to perform the above operations: :download:`Download .cmd file <../_static/assets/windows_create_dirs.cmd>` @@ -65,7 +65,7 @@ cd into <install_location>/code .. code-block:: bash - git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-coordinator.git coordinator;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-environmental-suitability.git environmental_suitability;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-advisory-builder.git advisory_builder;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-plotting.git plotting;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-epidemiology.git epimodel;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-source-calculation.git source_gen;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-job-flagging.git flagdir;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-met-processing.git met_extractor_v2;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-postprocessing.git post_processing; + git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-coordinator.git coordinator;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-environmental-suitability.git environmental_suitability;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-advisory-builder.git advisory_builder;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-plotting.git plotting;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-epidemiology.git epimodel;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-source-calculation.git source_gen;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-met-processing.git met_extractor_v2;git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-postprocessing.git post_processing; or generate this string in bash: @@ -77,7 +77,6 @@ or generate this string in bash: ews-plotting,plotting \ ews-epidemiology,epimodel \ ews-source-calculation,source_gen \ - ews-job-flagging,flagdir \ ews-met-processing,met_extractor_v2 \ ews-postprocessing,post_processing; do @@ -91,35 +90,67 @@ shell scripts to perform the above operations: :download:`Download .sh file <../_static/assets/linux_clone_git.sh>` -3: Copy the Resources needed for the various chart areas: +3: Copy the assets needed for the various chart areas: --------------------------------------------------------- -.. admonition:: Configuration files from Cambridge required +.. admonition:: Asset files from Cambridge required - Due to the size, project resources are not included in the git repository. You will need to ask the Cambridge team + Due to the size, project Assets are not included in the git repository. You will need to ask the Cambridge team for the latest version of the resources archive. -.. admonition:: Add resources for one region at a time +.. admonition:: Add assets for one region at a time - There is a seperate resources archive for each geographic region. Currently there are two regions, EastAfrica and + There is a separate assets archive for each geographic region. Currently there are two regions, EastAfrica and SouthAsia. The instructions below denote the different regions with <EastAfrica/SouthAsia>. We suggest you start with EastAfrica and get that working before setting up other regions. -Once you have received an archive of ``<EastAfrica/SouthAsia>_resources_<latest_date>.tar.gz`` from Cambridge, unpack -into ``<install_location>/regions/<EastAfrica/SouthAsia>/resources``. This will place all the necessary JSON -configuration and other assets required for the pipeline to run. +Once you have received an archive of ``<eastafrica/southasia>_resources_<latest_date>.tar.gz`` from Cambridge, unpack +into ``<install_location>/regions/<eastafrica/southasia>/resources/assets/``. This will place all the necessary assets +required for the pipeline to run. e.g.: .. code-block:: bash - cd <install_location>/regions/EastAfrica/resources + cd <install_location>/regions/EastAfrica/resources/assets tar -zxvf eastafrica_resources_<latest_date>.tar.gz -Edit the coordinator run script to fix the root paths **(not necessary if running in our docker image)**: +4: Clone the configs needed for the various chart areas: +--------------------------------------------------------- + +The configuration files are in region-specific gitlab repos. Clone each one to the corresponding resources dir: + +.. code-block:: bash + + cd <install_location>/regions/EastAfrica/resources; + git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-east-africa-configs.git configs/; -<install_location>/code/coordinator/scripts/run_Processor.py + cd <install_location>/regions/SouthAsia/resources; + git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-south-asia-configs.git configs/; -Put a valid email credentials file into <install_location>/envs/credentials/Cred_gmail.json +Make a copy of the template_sys_config_<EastAfrica/SouthAsia>_fc_live.json files and rename to: + +sys_config_EastAfrica_fc_live.json +sys_config_SouthAsia_fc_live.json + +Edit the newly copied sys_config files and edit the root directories to match your installation. These instructions are +based on using the pre-prepared Docker image, which should use the following values: + +.. code-block:: bash + + { + ... + "ProjectRoot" : "/storage/app/EWS_prod/", + "MetoFTP" : "/storage/sftp/", + ... + } + +If you are not planning to use Docker, and plan to build your own pyhon environment, you would set the values to the path on +your local drive: + + "ProjectRoot" : **"<install_location>"**, + "MetoFTP" : **"<install_location>/met_inputs/"**, + +**Put a valid email credentials file into <install_location>/envs/credentials/Cred_gmail.json** Example format: @@ -138,7 +169,15 @@ Example format: The example credentials above are for the Cambridge email account. You will need to replace the host/user etc with your own. -4: Run the docker image: +**Set the credentials file for the Wheat Rust Toolbox** + +Make a copy of the following files and remove the "template" prefix: + +<install_location>/regions/<EastAfrica/SouthAsia>configs/coordinator/template_Cred-WRT.json + +then set the username and password values (provided by Cambridge ot the WRT team). + +5: Run the docker image: ------------------------ install docker on your machine https://docs.docker.com/get-docker/ @@ -149,7 +188,7 @@ Build the docker image (slow, one-off step) cd <install_location>/code/coordinator/configs/docker/build/ By default, the buildfile will create an image with the user credentials of the Cam Epi group server. To make a version -with the right credentials to write you your filesystem, run the build script provided, but **edit to override the +with the right credentials to write to your filesystem, run the build script provided, but **edit to override the following credentials**: (from build.sh) @@ -163,9 +202,7 @@ Where the various variables are all LINUX user credentials (type the ‘id’ co **if you are running the ews for use on your personal computer, you can exclude the --build-arg arguments from the build step, note that all files written by the pipeline will be owned by the root user, rather than your user account.** -Once you have edited the build.sh script, run it (or run the commands within it manually). **if you are running on -Windows and run these commands manually, make sure you run the "cp ../../conda/conda-env-py3EWS-withbuilds.yml ." -equivalent to place the conda dependencies in the same dir before running docker build. +Once you have edited the build.sh script, run it (or run the commands within it manually). .. code-block:: bash @@ -195,7 +232,7 @@ Make a copy of the docker launch template file and edit the source dir to match When attached to a Docker container, you can detach, leaving the container running with ctrl+p+q. To reattach to a running container run docker attach <container_name>. -5: Run test commands within Docker: +6: Run test commands within Docker: ----------------------------------- You can run all the integration tests within the Docker container (using bundled data), or run commands that connect to a running Docker container and use met data deployed elsewhere on the filesystem. @@ -209,11 +246,17 @@ when attached to the running docker container: cd /storage/app/EWS_prod/code/coordinator/tests/integration/partial/ ./run_test_suite.sh -If successful, you will see lots of system out passing by, with a message like "Ran 14 tests in 0:01:13 OK" at the end. +When running the tests, you will see a print statement showing the tempo dir where the test reports will be written. You +will see a series of 'P' oe 'F' characters, representing the pass/fail status of each test; e.g. -outputs will be in: /storage/app/EWS_prod/code/coordinator/tests/test_data/test_deployment/regions/EastAfrica/workspace +.. code-block:: -6: Run a full run (using docker from outside the container) + LOGS AND TEST REPORT WILL BE IN /tmp/tmp.n30LfZVrjR + PPPPPPPPPPPPPP + +test pipeline outputs will be in: /storage/app/EWS_prod/code/coordinator/tests/test_data/test_deployment/regions/EastAfrica/workspace + +7: Run a full run (using docker from outside the container) ----------------------------------------------------------- .. admonition:: Met Office data required @@ -227,10 +270,8 @@ outputs will be in: /storage/app/EWS_prod/code/coordinator/tests/test_data/test_ .. admonition:: Remote accounts required In addition to the Met Office data, you will need to be able to connect to the various servers which host the survey - information. The Cambridge team will provide you with the necessary credential files, which are referred to in the - <install_location>regions/<region>/resources/coordinator/configs/Cred-ODK-EIAR.json file. - - **the necessary credentials file will be provided in the resources bundle provided by Cambridge** + information. The Cambridge team will provide you with the necessary credentials, which are referred to in the + <install_location>regions/<region>/resources/configs/coordinator/Cred-WRT.json. Edit config files to match your installation @@ -242,51 +283,23 @@ Edit config files to match your installation Docker container will mount the local paths to match the default config file. You will need to edit the config files if you are running the pipeline outside of the docker container to match your local filesystem. -**Note than when we refer to "the config file" we are refering to the main JSON config that is passed in from the command -line when running the pipeline. (e.g.** ``resources/coordinator/configs/config_EastAfrica_fc_live.json``). **each region will -have its own config file, e.g. config_EastAfrica_fc_live.json, config_SouthAsia_fc_live.json.** +**Note than when we refer to "the config files" we are referring to the main JSON configs that are passed in from the command +line when running the pipeline. +**each region and component will have its own config file, e.g. depo_config_EastAfrica_fc_live.json, depo_config_SouthAsia_fc_live.json.** +(e.g.** ``/storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/sys_config_EastAfrica_fc_live.json`` +``/storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/depo_config_EastAfrica_fc_live.json``). **Files will be copied using the "scp" command, so your computer will need to be able to run this command if you are not using Docker (it is usually included by default with Linux and will run by default in the Docker container)**. -You will need to edit the config files for each region to point at the correct server paths to retrieve from -and push to. - -**Set the path to publish pipeline outputs to, e.g.:** - -.. code-block:: json - - "ServerPath" : "/storage/webdir/Ethiopia/", - -**For the Environmental suitability pipeline, set the path into which the Met Office is uploading weather and NAME data:** - -**For the Deposition pipeline, set the path from which the Met Office downloads the source calculation results, e.g.:** - -.. code-block:: json - - "Environment" : { - "ServerPathTemplate" : "/storage/sftp/metofficeupload/fromMO/Ethiopia/daily_name/", - "Deposition" : { - "ServerPathTemplate" : "/storage/sftp/metofficeupload/toMO/Ethiopia/daily_name/", - -**Specify the output directory of the Survey pipeline, which should be the location from which the Met Office can download the results in order to feed them into the NAME calculation, e.g.** - - -.. code-block:: json - - "Survey" : { - "ServerPathExtra" : "/storage/sftp/metofficeupload/upload/Ethiopia/toMO/", - - **Running the pipeline** -One all the necessary input data and server connections are in place, you can run the pipeline. Note that if you need to -rerun a pipeline, you have to delete the output of the previous run. +One all the necessary input data and server connections are in place, you can run the pipeline. .. admonition:: Ensure the Docker container is running The following commands run the pipeline by launching a script on a running Docker container. Check the container is - running with "docker container ls -a", you chould see the "ews_runner" container running. If it is not running, you can run + running with "docker container ls -a", you should see the "ews_runner" container running. If it is not running, you can run it with "docker start ews_runner". Note that the "ews_runner" container will exist because you have created the container while running the "launchDocker_<installname>.sh" script described above. @@ -294,31 +307,32 @@ SurveyData ^^^^^^^^^^ (note: day should be the day before the Depo and Env suit dates, also note that the Survey data needs to be run before the Depo and Env suit data) -docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Survey_Processor.sh -c /storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json -s 20230125; +docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Survey_Processor.sh -s /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/sys_config_EastAfrica_fc_live.json -c /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/survey_config_EastAfrica_fc_live.json -d 20240714; Deposition: ^^^^^^^^^^^ -docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Deposition_Processor.sh -c /storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json -s 20230126 +docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Deposition_Processor.sh -s /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/sys_config_EastAfrica_fc_live.json -c /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/depo_config_EastAfrica_fc_live.json -d 20240715; Env suit: ^^^^^^^^^ -docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Environment_Processor.sh -c /storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json -s 20230126; +docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Environment_Processor.sh -s /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/sys_config_EastAfrica_fc_live.json -c /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/env_suit_config_EastAfrica_fc_live.json -d 20240715; EPI: ^^^^ -Set the start of the season be editing the following lines in <install_location>/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json +Set the start of the season be editing the following lines in <install_location>/EWS_prod/regions/EastAfrica/resources/configs/coordinator/epi_config_EastAfrica_fc_live.json .. code-block:: json - Line 176 "CalculationSpanDays" : [0,1], - Line 177 "continue" : false, + Line 3 "CalculationSpanDays" : ["20240715",5], + Line 4 "continue" : false, -docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Epidemiology_Processor.sh -c /storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json -s 20230126; +docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Epidemiology_Processor.sh -s /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/sys_config_EastAfrica_fc_live.json -c /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/epi_config_EastAfrica_fc_live.json -d 20240715; -[note that the survey, Environmental Suitability and Deposition pipelines need to be run before the EPI pipeline] +[note that the Environmental Suitability and Deposition pipelines need to be run before the EPI pipeline and also +requires the previous day to have been run for Environmental Suitability and Deposition (20240714)] Advisory: ^^^^^^^^^ -docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Advisory_Processor.sh -c /storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json -s 20220808; +docker exec ews_runner /storage/app/EWS_prod/code/coordinator/scripts/run_Advisory_Processor.sh -s /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/sys_config_EastAfrica_fc_live.json -c /storage/app/EWS_prod/regions/EastAfrica/resources/configs/coordinator/fc/advisory_config_EastAfrica_fc_live.json -d 20240715; [note that the Survey, Environmental Suitability, Deposition and Epidemiology pipelines need to be run before the Advisory pipeline] \ No newline at end of file diff --git a/docs/_source/package_overview.rst b/docs/_source/package_overview.rst index 55c739f75e04529515ed7284c4496125a45e50db..3fd5698754da99055c769b62303a3fefee5f60a8 100644 --- a/docs/_source/package_overview.rst +++ b/docs/_source/package_overview.rst @@ -26,7 +26,6 @@ Use the links below or in the side menu to see detailed descriptions of individu :class:`ews.coordinator`, "Coordinates the running of all pipeline modules" :class:`ews.postprocessing`, "Determines the business performed by the Coordinator pipeline ""post-processing"" step" - :class:`flagdir`, "Basic flag-file handling within a provided directory" :class:`ews.plotting`, "Plots maps from the pipeline outputs" **Deposition:** @@ -53,7 +52,7 @@ Use the links below or in the side menu to see detailed descriptions of individu :header: "Package", "Description" :widths: 15, 30 - :class:`EpiModel`, "Simulates infected area of grid cells according to epidmiological formulations and various input data streams." + :class:`ews.epi_model`, "Simulates infected area of grid cells according to epidemiological formulations and various input data streams." **Advisory builder:** diff --git a/docs/_static/assets/linux_clone_git.sh b/docs/_static/assets/linux_clone_git.sh index 1a6c4d2fe22287c5ca66581812d02eb39043560d..ed566ef43d2caf739e14b9c5a9a288ddf9ec37e1 100644 --- a/docs/_static/assets/linux_clone_git.sh +++ b/docs/_static/assets/linux_clone_git.sh @@ -5,6 +5,5 @@ git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-advisory git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-plotting.git plotting; git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-epidemiology.git epimodel; git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-source-calculation.git source_gen; -git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-job-flagging.git flagdir; git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-met-processing.git met_extractor_v2; git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-postprocessing.git post_processing; \ No newline at end of file diff --git a/docs/_static/assets/linux_create_dirs.sh b/docs/_static/assets/linux_create_dirs.sh index fea167b1ca19f0703fecd90fe7f0d5bde490c974..b85e04895c39cb612f86cca378385458dfc52eb7 100644 --- a/docs/_static/assets/linux_create_dirs.sh +++ b/docs/_static/assets/linux_create_dirs.sh @@ -4,6 +4,8 @@ mkdir -p regions/EastAfrica/workspace; mkdir -p regions/SouthAsia/workspace; mkdir -p regions/EastAfrica/resources; mkdir -p regions/SouthAsia/resources; +mkdir -p regions/EastAfrica/resources/assets; +mkdir -p regions/SouthAsia/resources/assets; mkdir -p met_inputs/metofficeupload/upload/Ethiopia/toMO/; mkdir -p met_inputs/metofficeupload/upload/Ethiopia/fromMO/daily_name/; mkdir -p web_data/Ethiopia; diff --git a/docs/_static/assets/windows_clone_git.cmd b/docs/_static/assets/windows_clone_git.cmd index e1dbd4ffdac9f54fd81a32872e4aa27b0376aca3..146bf7ae1295c389fb467652bfe10d98acf01940 100644 --- a/docs/_static/assets/windows_clone_git.cmd +++ b/docs/_static/assets/windows_clone_git.cmd @@ -5,6 +5,5 @@ git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-advisory git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-plotting.git plotting git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-epidemiology.git epimodel git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-source-calculation.git source_gen -git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-job-flagging.git flagdir git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-met-processing.git met_extractor_v2 git clone git@gitlab.developers.cam.ac.uk:gilligan-epid/wheat-rusts/ews-postprocessing.git post_processing \ No newline at end of file diff --git a/docs/_static/assets/windows_create_dirs.cmd b/docs/_static/assets/windows_create_dirs.cmd index 78039402c415a3cedcdd68f833612e3cd36c27e9..64807a00865875ad6335b561f3b1e19c877f9288 100644 --- a/docs/_static/assets/windows_create_dirs.cmd +++ b/docs/_static/assets/windows_create_dirs.cmd @@ -1,2 +1,2 @@ @ECHO OFF -mkdir .\code regions\EastAfrica\workspace regions\SouthAsia\workspace regions\EastAfrica\resources regions\SouthAsia\resources met_inputs\metofficeupload\upload\Ethiopia\toMO\ met_inputs\metofficeupload\upload\Ethiopia\fromMO\daily_name\ web_data\Ethiopia met_inputs\metofficeupload\upload\SouthAsia\toMO\ met_inputs\metofficeupload\upload\SouthAsia\fromMO\daily_name\ web_data\SouthAsia .\logs .\envs\credentials \ No newline at end of file +mkdir .\code regions\EastAfrica\workspace regions\SouthAsia\workspace regions\EastAfrica\resources regions\EastAfrica\resources\assets regions\SouthAsia\resources regions\SouthAsia\resources_assets met_inputs\metofficeupload\upload\Ethiopia\toMO\ met_inputs\metofficeupload\upload\Ethiopia\fromMO\daily_name\ web_data\Ethiopia met_inputs\metofficeupload\upload\SouthAsia\toMO\ met_inputs\metofficeupload\upload\SouthAsia\fromMO\daily_name\ web_data\SouthAsia .\logs .\envs\credentials \ No newline at end of file diff --git a/docs/api.rst b/docs/api.rst index 22c3e326dea8e9873765673d0707e6ee732d2251..5dd631150b23c665c0e0433815cae7539a035a87 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -12,6 +12,5 @@ API ews.met_processing ews.environmental_suitability ews.source_gen - EpiModel - flagdir + ews.epi_model ews.advisory_builder diff --git a/docs/index.rst b/docs/index.rst index 08a8e799116f9eb33748165b0cd47d88c7dcf411..de42f762d1d84ed3dc41d2ba5e532cce24570018 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -27,7 +27,7 @@ the pipeline currently running at the University of Cambridge. met processing API <_autosummary/ews.met_processing> env suit API <_autosummary/ews.environmental_suitability> source gen API <_autosummary/ews.source_gen> - epimodel API <_autosummary/EpiModel> + epimodel API <_autosummary/ews.epi_model> advisory API <_autosummary/ews.advisory_builder> diff --git a/ews/coordinator/processor_base.py b/ews/coordinator/processor_base.py index 993ccd969fdb8061545fb15164883c53317959c1..fe883ab7615e993c0c50cfe0923fcf6c9e22333d 100755 --- a/ews/coordinator/processor_base.py +++ b/ews/coordinator/processor_base.py @@ -25,9 +25,6 @@ from ews.coordinator.utils.processor_utils import end_script, end_job, append_it clear_up, parse_json_file_with_tokens -print("Make sure to `conda activate py3EWSepi` environment!") -print("Make sure that flagdir package is available (on PYTHONPATH)") - import argparse import datetime import json @@ -49,8 +46,8 @@ class ProcessorBase: def __init__(self) -> None: super().__init__() time_now = datetime.datetime.today() - self.todayString = time_now.strftime('%Y%m%d') - self.nowString = time_now.strftime('%Y%m%d-%H%M-%S') + self.today_string = time_now.strftime('%Y%m%d') + self.now_string = time_now.strftime('%Y%m%d-%H%M-%S') def parse_and_check_args(self) -> dict: @@ -102,7 +99,7 @@ class ProcessorBase: '-d', '--run-date', metavar = 'YYYYMMDD', action = 'store', - default = self.todayString, + default = self.today_string, help = 'Initial day of calculation, starting at 00 UTC (Default is today)', dest = 'start_date', ) @@ -132,11 +129,11 @@ class ProcessorBase: raise RuntimeError # check the startstring - if args.start_date is not self.todayString: + if args.start_date is not self.today_string: try: # check date string is formatted correctly provided_start_date = datetime.datetime.strptime(args.start_date, '%Y%m%d') - today_date = datetime.datetime.strptime(self.todayString, '%Y%m%d') + today_date = datetime.datetime.strptime(self.today_string, '%Y%m%d') # early limit is quite arbitrary, but this is earliest year of available survey data for Ethiopia date_limit_early = datetime.datetime.strptime('20070101', '%Y%m%d') @@ -201,7 +198,7 @@ class ProcessorBase: :return: """ if os.path.exists(job_path): - archived_dir_path = f"{job_path}-ARCHIVE_{self.nowString}" + archived_dir_path = f"{job_path}-ARCHIVE_{self.now_string}" message = f"Job path {job_path} already exists, so moving it to {archived_dir_path}" print(message) os.rename(job_path, archived_dir_path) @@ -383,8 +380,6 @@ class ProcessorBase: raise NotImplementedError def run_processor(self, component: str, shortname: str): - logger.info("Make sure to `conda activate py3EWSepi` environment!") - logger.info("Make sure that flagdir package is available (on PYTHONPATH)") try: args: dict = self.parse_and_check_args() args["component"] = component diff --git a/scripts/run_Scraper_Processor.sh b/scripts/run_Scraper_Processor.sh index 15de91bffe3130372ea576ef3bd20f76307bda60..971c17d1e030a83a7942bd4e014ab351a7bef3a0 100755 --- a/scripts/run_Scraper_Processor.sh +++ b/scripts/run_Scraper_Processor.sh @@ -7,7 +7,8 @@ source "${proc_path}"/run_utils.sh setup_virtual_env -python "${proc_path}"/../ews/coordinator/processor_scraper.py "$@" +#python "${proc_path}"/../ews/coordinator/processor_scraper.py "$@" +echo "WE HAVE NOT WIRED IN THE PROCESSOR DO IT HERE IF YOU WANT TO RUN IT!" exit_code=$? teardown_virtual_env diff --git a/scripts/run_utils.sh b/scripts/run_utils.sh index 181c9bb4058a42ad58590ded780c746e9db1a18b..dc2bd06a13d17df8e4e6a2bc6c1d6f55f507ca57 100755 --- a/scripts/run_utils.sh +++ b/scripts/run_utils.sh @@ -21,7 +21,6 @@ function setup_virtual_env() { # provide path to email credentials for logging - export LOGGING_CONFIG=${bin}/coordinator/configs/logger/log_config.json export EMAIL_CRED=${envs}/credentials/Cred_gmail.json # activate venv environment of python modules so they can be imported diff --git a/tests/integration/partial/run_test_suite.py b/tests/integration/partial/run_test_suite.py index cde1c81d2b68ccfc3a4b57d3c61824ad472ed079..a75b00a639533a57022de983191e9f71c14e3146 100644 --- a/tests/integration/partial/run_test_suite.py +++ b/tests/integration/partial/run_test_suite.py @@ -21,7 +21,8 @@ def build_test_runner() -> TestSuite: if __name__ == '__main__': _output_dir = sys.argv.pop() _tests = build_test_runner() - _runner = HTMLTestRunner(output=_output_dir) + _runner = HTMLTestRunner(output=_output_dir, log = True) _result: TestResult = _runner.run(_tests) if not _result.wasSuccessful(): + print(f"One or more tests failed - see the HTML report for details ({_output_dir})") sys.exit(1) diff --git a/tests/integration/partial/run_test_suite.sh b/tests/integration/partial/run_test_suite.sh index e4c8546a437eaf11a1278bb0258e01a9234e5fbd..6b0a1604ddb7ec87365433ada0acaca29c68cebb 100755 --- a/tests/integration/partial/run_test_suite.sh +++ b/tests/integration/partial/run_test_suite.sh @@ -3,12 +3,12 @@ # software installed. it writes files to a unix tmp dir and is not intended to be used for diagnostic testing, just # checking the installation is working -source /storage/app/miniconda3/bin/activate /storage/app/EWS_prod/envs/conda/py3EWS/ +source /storage/app/EWS_prod/envs/venv/ews_prod/bin/activate +pip install coverage; # assumes run from the tests/integration/partial dir, and that all necessary packages are checked out alongside PACKAGES_DIR="../../../../" -flagdir=$PACKAGES_DIR/flagdir epimodel=$PACKAGES_DIR/epimodel advisory=$PACKAGES_DIR/advisory_builder met_processing=$PACKAGES_DIR/met_extractor_v2 @@ -16,12 +16,13 @@ met_processor=$PACKAGES_DIR/environmental_suitability plotting=$PACKAGES_DIR/plotting post_processing=$PACKAGES_DIR/post_processing source_gen=$PACKAGES_DIR/source_gen -coordinator=$PACKAGES_DIR/coordinator/coordinator +coordinator=$PACKAGES_DIR/coordinator coordinator_tests=$PACKAGES_DIR/coordinator/tests -export PYTHONPATH=$PYTHONPATH:$flagdir:$epimodel:$advisory:$met_processing:$met_processor:$plotting:$source_gen:$post_processing:$coordinator:$coordinator_tests +export PYTHONPATH=$PYTHONPATH:$epimodel:$advisory:$met_processing:$met_processor:$plotting:$source_gen:$post_processing:$coordinator:$coordinator_tests echo $PYTHONPATH tempdir=$(mktemp -d) +printf "LOGS AND TEST REPORT WILL BE IN %s\n" "$tempdir" python3 -m coverage run run_test_suite.py "$tempdir" diff --git a/tests/test_data/test_deployment/regions/EastAfrica/resources/configs/coordinator/advisory_config_EastAfrica_fc_live.json b/tests/test_data/test_deployment/regions/EastAfrica/resources/configs/coordinator/advisory_config_EastAfrica_fc_live.json index 6f19b670c33d7d1e54d970453117387bcac986b8..a1e1f9374309ecc08cb6d7737a46437236d0e641 100644 --- a/tests/test_data/test_deployment/regions/EastAfrica/resources/configs/coordinator/advisory_config_EastAfrica_fc_live.json +++ b/tests/test_data/test_deployment/regions/EastAfrica/resources/configs/coordinator/advisory_config_EastAfrica_fc_live.json @@ -97,5 +97,11 @@ "LabelZoom" : 7 } }, + "Forecasts" : { + "temperature_forecast_url": "http://wxmaps.org/pix/temp10.png", + "temperature_save_file": "temp_forecast_east_africa.png", + "precipitation_forecast_url": "http://wxmaps.org/pix/prec10.png", + "precipitation_save_file": "precepitation_forecast_east_africa.png" + }, "logos" : "${AssetsPath}/advisory_builder/logos_EastAfrica_plotting.png" }