Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update gitignore, add new component, update two components #250

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ celerybeat.pid
.mypy_cache/
.pyre/
.pytype/
cython_debug/
cython_debug/
venv/
45 changes: 45 additions & 0 deletions component-library/examples/alert_for_content_in_url.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
cwlVersion: v1.2
class: CommandLineTool

baseCommand: "claimed"

inputs:
component:
type: string
default: romeokienzler/claimed-alert-for-content-in-url:0.6
inputBinding:
position: 1
prefix: --component
log_level:
type: string
default: "INFO"
inputBinding:
position: 2
prefix: --log_level
url_to_notify:
type: string
default: None
inputBinding:
position: 3
prefix: --url_to_notify
url_to_query:
type: string
default: None
inputBinding:
position: 4
prefix: --url_to_query
filter_content:
type: string
default: None
inputBinding:
position: 5
prefix: --filter_content
sleep:
type: int
default: 30
inputBinding:
position: 6
prefix: --sleep


outputs: []
88 changes: 88 additions & 0 deletions component-library/examples/alert_for_content_in_url.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# alert_for_content_in_url"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Reqularly check if a URL has a specific content and if true call another url"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install requests"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import requests\n",
"import time"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"url_to_notify = os.getenv('url_to_notify')\n",
"url_to_query = os.getenv('url_to_query')\n",
"filter_content = os.getenv('filter_content')\n",
"sleep = int(os.getenv('sleep','30'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"while True:\n",
" r = requests.get(url_to_query)\n",
" lines = r.text.split('\\n')\n",
"\n",
" for line in lines:\n",
" if filter_content in line:\n",
" print(requests.get(url_to_notify).text)\n",
" break\n",
" time.sleep(sleep)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
26 changes: 26 additions & 0 deletions component-library/examples/alert_for_content_in_url.job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: batch/v1
kind: Job
metadata:
name: alert-for-content-in-url
spec:
template:
spec:
containers:
- name: alert-for-content-in-url
image: romeokienzler/claimed-alert-for-content-in-url:0.6
workingDir: /opt/app-root/src/
command: ["/opt/app-root/bin/ipython","claimed_alert_for_content_in_url.ipynb"]
env:
- name: log_level
value: value_of_log_level
- name: url_to_notify
value: value_of_url_to_notify
- name: url_to_query
value: value_of_url_to_query
- name: filter_content
value: value_of_filter_content
- name: sleep
value: value_of_sleep
restartPolicy: OnFailure
imagePullSecrets:
- name: image_pull_secret
27 changes: 27 additions & 0 deletions component-library/examples/alert_for_content_in_url.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: sleep
description: "# alert_for_content_in_url Reqularly check if a URL has a specific content and if true call another url – CLAIMED V0.1"

inputs:
- {name: log_level, type: String, description: "update log level", default: "INFO"}
- {name: url_to_notify, type: String, description: ""}
- {name: url_to_query, type: String, description: ""}
- {name: filter_content, type: String, description: ""}
- {name: sleep, type: Integer, description: "", default: "30'"}


outputs:


implementation:
container:
image: romeokienzler/claimed-sleep:0.6
command:
- sh
- -ec
- |
ipython ./claimed_alert_for_content_in_url.ipynb log_level="${0}" url_to_notify="${1}" url_to_query="${2}" filter_content="${3}" sleep="${4}"
- {inputValue: log_level}
- {inputValue: url_to_notify}
- {inputValue: url_to_query}
- {inputValue: filter_content}
- {inputValue: sleep}
147 changes: 147 additions & 0 deletions component-library/examples/hello_world.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# hello-world"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"This is the description of hello world"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting geopandas\n",
" Obtaining dependency information for geopandas from https://files.pythonhosted.org/packages/27/27/2687abaa2ac02b5814e2929a5033da1e5d132c19a904dc56f77f63fd6eb9/geopandas-0.14.0-py3-none-any.whl.metadata\n",
" Using cached geopandas-0.14.0-py3-none-any.whl.metadata (1.5 kB)\n",
"Collecting fiona>=1.8.21 (from geopandas)\n",
" Obtaining dependency information for fiona>=1.8.21 from https://files.pythonhosted.org/packages/07/ea/6674320c62a688bc1dc14201dfb7d4aeaea0939a1e733b85bae39e177325/fiona-1.9.5-cp311-cp311-manylinux2014_x86_64.whl.metadata\n",
" Using cached fiona-1.9.5-cp311-cp311-manylinux2014_x86_64.whl.metadata (49 kB)\n",
"Requirement already satisfied: packaging in /home/romeokienzler/gitco/component-library/.venv/lib64/python3.11/site-packages (from geopandas) (23.1)\n",
"Collecting pandas>=1.4.0 (from geopandas)\n",
" Obtaining dependency information for pandas>=1.4.0 from https://files.pythonhosted.org/packages/f1/c5/1e9c317a5e6af9280ad86a523ab6efe2ca70a0eb4bfb2220d8d08e255ae1/pandas-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata\n",
" Using cached pandas-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (18 kB)\n",
"Collecting pyproj>=3.3.0 (from geopandas)\n",
" Obtaining dependency information for pyproj>=3.3.0 from https://files.pythonhosted.org/packages/64/90/dfe5c00de1ca4dbb82606e79790659d4ed7f0ed8d372bccb3baca2a5abe0/pyproj-3.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata\n",
" Using cached pyproj-3.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (31 kB)\n",
"Collecting shapely>=1.8.0 (from geopandas)\n",
" Obtaining dependency information for shapely>=1.8.0 from https://files.pythonhosted.org/packages/8c/47/05c8bb8322861113e72b903aebaaa4678ae6e44c886c189ad8fe297f2008/shapely-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata\n",
" Using cached shapely-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.0 kB)\n",
"Collecting attrs>=19.2.0 (from fiona>=1.8.21->geopandas)\n",
" Using cached attrs-23.1.0-py3-none-any.whl (61 kB)\n",
"Collecting certifi (from fiona>=1.8.21->geopandas)\n",
" Obtaining dependency information for certifi from https://files.pythonhosted.org/packages/4c/dd/2234eab22353ffc7d94e8d13177aaa050113286e93e7b40eae01fbf7c3d9/certifi-2023.7.22-py3-none-any.whl.metadata\n",
" Using cached certifi-2023.7.22-py3-none-any.whl.metadata (2.2 kB)\n",
"Collecting click~=8.0 (from fiona>=1.8.21->geopandas)\n",
" Obtaining dependency information for click~=8.0 from https://files.pythonhosted.org/packages/00/2e/d53fa4befbf2cfa713304affc7ca780ce4fc1fd8710527771b58311a3229/click-8.1.7-py3-none-any.whl.metadata\n",
" Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)\n",
"Collecting click-plugins>=1.0 (from fiona>=1.8.21->geopandas)\n",
" Using cached click_plugins-1.1.1-py2.py3-none-any.whl (7.5 kB)\n",
"Collecting cligj>=0.5 (from fiona>=1.8.21->geopandas)\n",
" Using cached cligj-0.7.2-py3-none-any.whl (7.1 kB)\n",
"Requirement already satisfied: six in /home/romeokienzler/gitco/component-library/.venv/lib64/python3.11/site-packages (from fiona>=1.8.21->geopandas) (1.16.0)\n",
"Requirement already satisfied: setuptools in /home/romeokienzler/gitco/component-library/.venv/lib64/python3.11/site-packages (from fiona>=1.8.21->geopandas) (62.6.0)\n",
"Collecting numpy<2,>=1.23.2 (from pandas>=1.4.0->geopandas)\n",
" Obtaining dependency information for numpy<2,>=1.23.2 from https://files.pythonhosted.org/packages/8a/08/a7e5dadc21fe193baea5f257e11b7b70cc27a89692fc9e3ed690e55cc4b6/numpy-1.26.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata\n",
" Using cached numpy-1.26.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /home/romeokienzler/gitco/component-library/.venv/lib64/python3.11/site-packages (from pandas>=1.4.0->geopandas) (2.8.2)\n",
"Collecting pytz>=2020.1 (from pandas>=1.4.0->geopandas)\n",
" Obtaining dependency information for pytz>=2020.1 from https://files.pythonhosted.org/packages/32/4d/aaf7eff5deb402fd9a24a1449a8119f00d74ae9c2efa79f8ef9994261fc2/pytz-2023.3.post1-py2.py3-none-any.whl.metadata\n",
" Using cached pytz-2023.3.post1-py2.py3-none-any.whl.metadata (22 kB)\n",
"Collecting tzdata>=2022.1 (from pandas>=1.4.0->geopandas)\n",
" Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB)\n",
"Using cached geopandas-0.14.0-py3-none-any.whl (1.1 MB)\n",
"Using cached fiona-1.9.5-cp311-cp311-manylinux2014_x86_64.whl (15.7 MB)\n",
"Using cached pandas-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.2 MB)\n",
"Using cached pyproj-3.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB)\n",
"Using cached shapely-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB)\n",
"Using cached click-8.1.7-py3-none-any.whl (97 kB)\n",
"Using cached numpy-1.26.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)\n",
"Using cached pytz-2023.3.post1-py2.py3-none-any.whl (502 kB)\n",
"Using cached certifi-2023.7.22-py3-none-any.whl (158 kB)\n",
"Installing collected packages: pytz, tzdata, numpy, click, certifi, attrs, shapely, pyproj, pandas, cligj, click-plugins, fiona, geopandas\n",
"Successfully installed attrs-23.1.0 certifi-2023.7.22 click-8.1.7 click-plugins-1.1.1 cligj-0.7.2 fiona-1.9.5 geopandas-0.14.0 numpy-1.26.1 pandas-2.1.2 pyproj-3.6.1 pytz-2023.3.post1 shapely-2.0.2 tzdata-2023.3\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.1\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
]
}
],
"source": [
"!pip install geopandas"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import geopandas as gpd\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# the name to greet (mandatory)\n",
"name = os.getenv('name')\n",
"\n",
"# the place to greet (optional)\n",
"place = os.getenv('place', 'World')\n",
"\n",
"# the number of times to repeat the greeting (optional)\n",
"count = int(os.getenv('count', '1'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for count in range(count):\n",
" print(f\"Hello {name}, in {place}!\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
24 changes: 24 additions & 0 deletions component-library/examples/hello_world.job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: batch/v1
kind: Job
metadata:
name: hello-world
spec:
parallelism: 100
template:
spec:
containers:
- name: hello-world
image: docker.io/romeokienzler/claimed-hello-world:0.1
command: ["/opt/app-root/bin/python","/opt/app-root/src/hello_world.py"]
env:
- name: log_level
value: value_of_log_level
- name: name
value: value_of_name
- name: place
value: value_of_place
- name: count
value: value_of_count
restartPolicy: OnFailure
imagePullSecrets:
- name: image_pull_secret
25 changes: 25 additions & 0 deletions component-library/examples/hello_world.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: hello-world
description: "# hello-world This is the description of hello world – CLAIMED V0.1"

inputs:
- {name: log_level, type: String, description: "update log level", default: "INFO"}
- {name: name, type: String, description: "the name to greet (mandatory)"}
- {name: place, type: String, description: "the place to greet (optional)", default: "World"}
- {name: count, type: Integer, description: "the number of times to repeat the greeting (optional)", default: "'1'"}


outputs:


implementation:
container:
image: docker.io/romeokienzler/claimed-hello-world:0.1
command:
- sh
- -ec
- |
python ./hello_world.py log_level="${0}" name="${1}" place="${2}" count="${3}"
- {inputValue: log_level}
- {inputValue: name}
- {inputValue: place}
- {inputValue: count}
Loading
Loading