You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a main ticket from which you will want to create a set of sub-tickets.
What is the CEDA WPS?
The CEDA WPS (Web Processing Service) is actually a collection of tools/components/services. The front-end is a web application written in Pyramid that provides users with access to a range of functions (known as processes in WPS) that are packaged together in individual services called WPSs.
Each WPS provides an endpoint that follows the OGC WPS specification, an API exposing simple methods:
GetCapabilities - find out service metadata and which processes exist
DescribeProcess - find out which parameters need to be defined to call a process
Execute - run a process with the parameters provided in the user request
The climate stripes process is currently implemented as part of vulture (but we will probably move it to its own WPS as part of this work.
The user form for submitting a job looks like this for the current UK Climate Stripes process:
It generates a PDF, so that people can generate climate stripes for a UK location, and find out what the colours are (for re-use in other projects). Which looks like this:
Here is the only data file that we need to use:/badc/cru/data/cru_ts/cru_ts_4.08/data/tmp/cru_ts4.08.1901.2023.tmp.dat.nc
This is simpler than the current dataset, which uses a Kerchunk JSON file to link to multiple NC files.
Development environment
As well as the production system, there is a development (staging) VM where we run both the front-end web app (using nginx) and the backend WPS services (using supervisord). The staging server is only visible inside the JASMIN firewall (i.e. on the VPN). It is visible at: https://ceda-wps-staging.ceda.ac.uk/
Note that wiring up the client and server on a single test VM is complex, more instructions are here:
NOTE: The above settings are not how it is managed on the production system - it is only done this way in order to make the server and client compatible on the dev server.
Working with the Dev front-end (phoenix)
To access the code and service for the front end, do:
This will activate the conda environment that runs phoenix and it will put you in the directory where you can potentially make changes.
NOTE: the directory you are in, /code/local/pyramid-phoenix, is a checkout of the Git master branch.
Restart the service with:
make restart
The admin interface - used for adding a WPS
When you have made changes to a WPS back-end, you may need to re-add it to the front-end via the admin interface (get the password from Alan/Ag), which looks like:
To get to that page, click on Settings --> Services --> Register a new service. Fill out the form as above.
Git etiquette
Make sure that you create a new branch in the local git repo if you are making changes.
When you are ready for changes to be reviewed, create a Pull Request on GitHub and ask @agstephens or @alaniwi to review and accept it.
Proposed approach
I suggest you follow this approach:
Step 1:
Copy and paste the two main files (listed above) and just rename to "wps_plot_climate_stripes_global" and "WPSPlotClimateStripesGlobal" in the relevant places.
Wire up the new code to the NetCDF file that we are using and then remove the parts you don't need in the new version.
Update the /usr/local/birdhouse/etc/phoenix/ceda_process_role_map.json file to include the new process ID in the open processes. Then restart the front end.
Update a few other files that are required for imports to work - look in some of the __init__.py files for this.
Note that the UK stuff includes translating lat/lon to OGSB - in the global data you don't need any of that.
Note that the Kerchunk stuff is all redundant for the Global NC file so you can open it directly with xarray.
Get it running.
Step 2:
Refactor the vulture/stripes_lib/stripes.py module so that both the UK and Global files use mainly the same code.
Create a new WPS, and move both processes into that.
Rename the processes so that UK and Global are in the names.
Look at other improvements on the list above.
Troubleshooting and general tips
Do you want more detailed logging on the backend (vulture)?
Once you are in the correct vulture setup, you can run:
python -m pytest - it should run some tests (more would be great ;-)
Keep getting a 502 error in the front-end
A 502 error is normally associated with a problem or error in the CEDA security config file on the server. Maybe this config file needs editing and phoenix needs restarting:
process not in "open" processes list when it should be
process name has not yet been added to the file.
This file manages access control so it is often the reason why Phoenix just gets stuck and returns a 502 error.
Jobs are accepted but never run (when watching them in the front-end logs)
Sometimes jobs start running fine, but then just sit in a suspended status with no indication of why. On the front-end, you just see that the job was accepted but no other logs. Here is an explanation:
In the config of vulture, it has a fixed number of jobs that can be run concurrently - which is probably set by the command-line option: --maxprocesses
The --database option uses the local file, pywps-logs.sqlite as the database that Vulture uses to manage and record its job details. (It is confusingly called logs when it is actually the server-side persistent DB).
If the number of jobs submitted that didn't complete exceeds maxprocesses then new jobs will sit in the database as being in progress - which means the Pywps thinks they are running.
It will then block more jobs from running and the front-end will just show them as accepted in its output logs - but will never progress further.
As part of tidying things up, please change the vulture/cli.py file so that that the default database option is called: pywps-db.sqlite instead of pywps-logs.sqlite.
The text was updated successfully, but these errors were encountered:
This is a main ticket from which you will want to create a set of sub-tickets.
What is the CEDA WPS?
The CEDA WPS (Web Processing Service) is actually a collection of tools/components/services. The front-end is a web application written in
Pyramid
that provides users with access to a range of functions (known as processes in WPS) that are packaged together in individual services called WPSs.Each WPS provides an endpoint that follows the OGC WPS specification, an API exposing simple methods:
GetCapabilities
- find out service metadata and which processes existDescribeProcess
- find out which parameters need to be defined to call a processExecute
- run a process with the parameters provided in the user requestList of WPS names and functions
What are the WPS repositories/components?
What is the Climate Stripes process?
We currently provide a "Climate Stripes" CEDA WPS Process here:
https://ceda-wps-ui.ceda.ac.uk/processes/execute?wps=compliance_checker&process=PlotClimateStripes
The climate stripes process is currently implemented as part of vulture (but we will probably move it to its own WPS as part of this work.
The user form for submitting a job looks like this for the current UK Climate Stripes process:
It generates a PDF, so that people can generate climate stripes for a UK location, and find out what the colours are (for re-use in other projects). Which looks like this:
The code
The code is located here:
Next step: climate stripes for global data
The SCD Team is in the USA for a conference in November. They would like to demo the WPS tool during this conference.
So we would like to:
Deadline
MVP - Minimal Viable Product
Better than MVP
MVP+:
Would be nice to have active hyperlinks, paragraphs etc in here (maybe from Markdown)
Which dataset should we use?
We propose using this dataset:
/badc/cru/data/cru_ts/cru_ts_4.08/data/tmp/cru_ts4.08.1901.2023.tmp.dat.nc
Development environment
As well as the production system, there is a development (staging) VM where we run both the front-end web app (using
nginx
) and the backend WPS services (usingsupervisord
). The staging server is only visible inside the JASMIN firewall (i.e. on the VPN). It is visible at: https://ceda-wps-staging.ceda.ac.uk/Note that wiring up the client and server on a single test VM is complex, more instructions are here:
cedadev/swallow#15 (comment)
Working with the Dev back-end WPS (vulture)
To access the code and service for the
vulture
, do:This will activate the conda environment that runs vulture and it will put you in the directory where you can potentially make changes.
NOTE: the directory you are in,
/usr/local/src/vulture
, is a checkout of the new Gitglobal-stripes
branch.Start the service with:
Stop the service with:
NOTE: The above settings are not how it is managed on the production system - it is only done this way in order to make the server and client compatible on the dev server.
Working with the Dev front-end (phoenix)
To access the code and service for the front end, do:
This will activate the conda environment that runs phoenix and it will put you in the directory where you can potentially make changes.
NOTE: the directory you are in,
/code/local/pyramid-phoenix
, is a checkout of the Gitmaster
branch.Restart the service with:
The admin interface - used for adding a WPS
When you have made changes to a WPS back-end, you may need to re-add it to the front-end via the admin interface (get the password from Alan/Ag), which looks like:
To get to that page, click on
Settings --> Services --> Register a new service
. Fill out the form as above.Git etiquette
Make sure that you create a new branch in the local git repo if you are making changes.
When you are ready for changes to be reviewed, create a Pull Request on GitHub and ask @agstephens or @alaniwi to review and accept it.
Proposed approach
I suggest you follow this approach:
Step 1:
/usr/local/birdhouse/etc/phoenix/ceda_process_role_map.json
file to include the new process ID in the open processes. Then restart the front end.__init__.py
files for this.xarray
.Step 2:
vulture/stripes_lib/stripes.py
module so that both the UK and Global files use mainly the same code.Troubleshooting and general tips
Do you want more detailed logging on the backend (vulture)?
Use:
There are a few unit tests
Once you are in the correct
vulture
setup, you can run:python -m pytest
- it should run some tests (more would be great ;-)Keep getting a 502 error in the front-end
A 502 error is normally associated with a problem or error in the CEDA security config file on the server. Maybe this config file needs editing and phoenix needs restarting:
Possible issues could be:
This file manages access control so it is often the reason why Phoenix just gets stuck and returns a 502 error.
Jobs are accepted but never run (when watching them in the front-end logs)
Sometimes jobs start running fine, but then just sit in a suspended status with no indication of why. On the front-end, you just see that the job was
accepted
but no other logs. Here is an explanation:vulture
, it has a fixed number of jobs that can be run concurrently - which is probably set by the command-line option:--maxprocesses
--database
option uses the local file,pywps-logs.sqlite
as the database that Vulture uses to manage and record its job details. (It is confusingly called logs when it is actually the server-side persistent DB).maxprocesses
then new jobs will sit in the database as being in progress - which means the Pywps thinks they are running.The fix is simple:
And then it should all work again.
As part of tidying things up, please change the
vulture/cli.py
file so that that the default database option is called:pywps-db.sqlite
instead ofpywps-logs.sqlite
.The text was updated successfully, but these errors were encountered: