generated from interTwin-eu/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0bf60d
commit 6e0fa0d
Showing
6 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env cwl-runner | ||
|
||
cwlVersion: v1.0 | ||
class: CommandLineTool | ||
baseCommand: python | ||
arguments: [$(inputs.uploadScript),"--bucket",$(inputs.bucket),"--filename", $(inputs.file), "--endpoint",$(inputs.minioEndpoint),"--accesskey",$(inputs.minioAccesskey),"--secretkey",$(inputs.minioSecretkey)] | ||
inputs: | ||
file: | ||
type: File? | ||
uploadScript: | ||
type: File? | ||
bucket: | ||
type: string | ||
minioEndpoint: | ||
type: string | ||
minioAccesskey: | ||
type: string | ||
minioSecretkey: | ||
type: string | ||
outputs: | ||
example_out: | ||
type: stdout | ||
stdout: output.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from minio import Minio | ||
import argparse | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument("--bucket") | ||
parser.add_argument("--filename") | ||
parser.add_argument("--endpoint") | ||
parser.add_argument("--accesskey") | ||
parser.add_argument("--secretkey") | ||
|
||
args = parser.parse_args() | ||
variables = vars(args) | ||
#print(variables) | ||
|
||
bucket=variables['bucket'] | ||
filename=variables['filename'] | ||
endpoint=variables['endpoint'] | ||
accesskey=variables['accesskey'] | ||
secretkey=variables['secretkey'] | ||
|
||
#print (bucket.split("/")[0],) | ||
#print('/'.join(sys.argv[1].split("/")[1:])) | ||
#print(filename.split("/")[-1]) | ||
#print(filename) | ||
|
||
# Create client with access and secret key. | ||
client = Minio(str(endpoint), accesskey, secretkey) | ||
|
||
result = client.fput_object( | ||
bucket.split("/")[0], '/'.join(bucket.split("/")[1:])+"/"+filename.split("/")[-1], filename, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env cwl-runner | ||
|
||
cwlVersion: v1.0 | ||
class: CommandLineTool | ||
baseCommand: python | ||
arguments: [$(inputs.waitScript),"--bucket",$(inputs.bucket), "--endpoint",$(inputs.minioEndpoint),"--accesskey",$(inputs.minioAccesskey),"--secretkey",$(inputs.minioSecretkey)] | ||
inputs: | ||
waitScript: | ||
type: File? | ||
bucket: | ||
type: string | ||
minioEndpoint: | ||
type: string | ||
minioAccesskey: | ||
type: string | ||
minioSecretkey: | ||
type: string | ||
outputs: | ||
example_out: | ||
type: stdout | ||
stdout: output.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from minio import Minio | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument("--bucket") | ||
parser.add_argument("--filename") | ||
parser.add_argument("--endpoint") | ||
parser.add_argument("--accesskey") | ||
parser.add_argument("--secretkey") | ||
|
||
args = parser.parse_args() | ||
variables = vars(args) | ||
#print(variables) | ||
|
||
bucket=variables['bucket'] | ||
filename=variables['filename'] | ||
endpoint=variables['endpoint'] | ||
accesskey=variables['accesskey'] | ||
secretkey=variables['secretkey'] | ||
|
||
|
||
# Create client with access and secret key. | ||
client = Minio(str(endpoint), accesskey, secretkey) | ||
|
||
with client.listen_bucket_notification( | ||
bucket.split("/")[0], | ||
prefix='/'.join(bucket.split("/")[1:]), | ||
events=["s3:ObjectCreated:*", "s3:ObjectRemoved:*"], | ||
) as events: | ||
for event in events: | ||
print(event["Records"][0]["s3"]["object"]["key"]) | ||
break | ||
#if(resultfile in event["Records"][0]["s3"]["object"]["key"]): | ||
# info=event | ||
# break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env cwl-runner | ||
|
||
cwlVersion: v1.2 | ||
class: Workflow | ||
|
||
requirements: | ||
InlineJavascriptRequirement: {} | ||
|
||
inputs: | ||
file: | ||
type: File? | ||
uploadScript: | ||
type: File? | ||
waitScript: | ||
type: File? | ||
minioEndpoint: | ||
type: string | ||
minioAccesskey: | ||
type: string | ||
minioSecretkey: | ||
type: string | ||
bucketInput: | ||
type: string | ||
bucketOutput: | ||
type: string | ||
outputs: | ||
out: | ||
type: File? | ||
outputSource: wait/example_out | ||
steps: | ||
upload: | ||
run: upload/upload.cwl | ||
in: | ||
file: file | ||
uploadScript: uploadScript | ||
bucket: bucketInput | ||
minioEndpoint: minioEndpoint | ||
minioAccesskey: minioAccesskey | ||
minioSecretkey: minioSecretkey | ||
out: [example_out] | ||
wait: | ||
run: wait_output/wait.cwl | ||
in: | ||
waitScript: waitScript | ||
bucket: bucketOutput | ||
minioEndpoint: minioEndpoint | ||
minioAccesskey: minioAccesskey | ||
minioSecretkey: minioSecretkey | ||
data: | ||
source: upload/example_out | ||
out: [example_out] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
file: | ||
class: File | ||
path: wflow_input.tar | ||
|
||
|
||
minioEndpoint: | ||
minioAccesskey: | ||
minioSecretkey: | ||
|
||
|
||
bucketInput: wflow/in | ||
bucketOutput: wflow/out | ||
|
||
|
||
uploadScript: | ||
class: File | ||
path: upload/upload.py | ||
|
||
waitScript: | ||
class: File | ||
path: wait_output/wait.py |