| name | reana-workflow-sin-plot |
| version | 1.0 |
| description | Automates creation, submission, monitoring, and retrieval of a REANA workflow that plots a green sine curve using pandas and matplotlib. |
| author | Hermes |
When to Use
Automates creation, submission, monitoring, and retrieval of a REANA workflow that plots a green sine curve using pandas and matplotlib.
Overview
This skill automates the full REANA workflow lifecycle for generating a green sine‑wave plot using pandas and matplotlib.
Prerequisites
- REANA server URL (default
https://reana.cern.ch).
- REANA access token with
workflow-create, workflow-start, workflow-getoutput, and workflow-status scopes.
- Python 3 on the host machine.
Steps
- (Optional) Isolate the REANA client
python3 -m venv ~/reana_venv
source ~/reana_venv/bin/activate
pip install --upgrade pip
pip install reana-client
- Create workflow directory
mkdir -p ~/reana_sin_workflow && cd ~/reana_sin_workflow
- Write
reana.yaml
name: sin-plot
description: Plot a sine curve in green using pandas & matplotlib.
environment:
image: gitlab-p4n.aip.de:5005/p4nreana/reana-env:py311-astro.9845
commands:
- python plot_sin.py
- Write
plot_sin.py
import numpy as np, pandas as pd, matplotlib.pyplot as plt
x = np.linspace(0, 2*np.pi, 200)
y = np.sin(x)
df = pd.DataFrame({'x': x, 'sin(x)': y})
ax = df.plot(x='x', y='sin(x)', color='green', legend=False)
ax.set_xlabel('x')
ax.set_ylabel('sin(x)')
ax.set_title('Sine wave (green)')
plt.tight_layout()
plt.savefig('sin_plot.png')
plt.close()
- (Optional)
requirements.txt – needed only when building a custom image.
pandas
matplotlib
numpy
- Upload workflow
reana-client upload -w sin-plot .
- Start workflow
reana-client start -w sin-plot
- Monitor until finished
while true; do
status=$(reana-client status -w sin-plot | grep -i status | awk '{print $2}')
echo "Current status: $status"
[[ "$status" =~ ^(finished|failed)$ ]] && break
sleep 5
done
- Retrieve the image
reana-client getoutput -w sin-plot sin_plot.png .
The file sin_plot.png will appear in the current directory.
Pitfalls & Tips
Verification
After step 9 you should have a sin_plot.png showing a smooth green sine wave with axis labels and a title.