Skip to content

Commit

Permalink
fibonacci
Browse files Browse the repository at this point in the history
Hello Romeo, here is the fibonacci claimed component you requested.
  • Loading branch information
creatermaker authored Apr 29, 2024
1 parent cd65831 commit 13c4a79
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
27 changes: 27 additions & 0 deletions component-library/examples/fibonacci.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cwlVersion: v1.2
class: CommandLineTool

baseCommand: "claimed"

inputs:
component:
type: string
default: docker.io/mdorzweiler/claimed-fibonacci:0.1
inputBinding:
position: 1
prefix: --component
log_level:
type: string
default: "INFO"
inputBinding:
position: 2
prefix: --log_level
b:
type: string
default: None
inputBinding:
position: 3
prefix: --b


outputs: []
20 changes: 20 additions & 0 deletions component-library/examples/fibonacci.job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: batch/v1
kind: Job
metadata:
name: fibonacci
spec:
template:
spec:
containers:
- name: fibonacci
image: docker.io/mdorzweiler/claimed-fibonacci:0.1
workingDir: /opt/app-root/src/
command: ["/opt/app-root/bin/python","claimed_fibonacci.py"]
env:
- name: log_level
value: value_of_log_level
- name: b
value: value_of_b
restartPolicy: OnFailure
imagePullSecrets:
- name: image_pull_secret
10 changes: 10 additions & 0 deletions component-library/examples/fibonacci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def fib(b):
n = int(b)
if n == 0:
return 0
if n == 1:
return 1
return fib(n-2) + fib(n-1)

b = os.getenv('b')
print(fib(b))
21 changes: 21 additions & 0 deletions component-library/examples/fibonacci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: fibonacci
description: "claimed-fibonacci – CLAIMED V0.1"

inputs:
- {name: log_level, type: String, description: "update log level", default: "INFO"}
- {name: b, type: String, description: ""}


outputs:


implementation:
container:
image: docker.io/mdorzweiler/claimed-fibonacci:0.1
command:
- sh
- -ec
- |
python ./claimed_fibonacci.py log_level="${0}" b="${1}"
- {inputValue: log_level}
- {inputValue: b}

0 comments on commit 13c4a79

Please sign in to comment.