Skip to content

Commit

Permalink
Added program to evaluate and dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
PalomoIFCA committed Oct 2, 2024
1 parent b321d3a commit 8a69948
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
5 changes: 5 additions & 0 deletions QC.Sty/pyophidia/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3-slim

COPY find_oph_workflows.py /usr/bin

RUN chmod +x /usr/bin/find_oph_workflows.py
59 changes: 59 additions & 0 deletions QC.Sty/pyophidia/find_oph_workflows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from PyOphidia import client
import os
import json
import argparse


def find(pattern, path):
result = []
for root, dirs, files in os.walk(path):
for name in files:
if pattern in name:
result.append(os.path.join(root, name))
return result


def get_input_args():
parser = argparse.ArgumentParser(description=("Find Ophidia workflows"))
parser.add_argument(
"--path", metavar="PATH", type=str, help="path to look for in the repository"
)
return parser.parse_args()


def evaluate_workflow(candidates):
ophclient = client.Client(
username="oph-user", password="oph-passwd", local_mode=True
)
passed = 0
passed_list = []
failed_list = []
for jsons in candidates:
f = open(str(jsons), "r")

data = json.load(f)
res, msg = ophclient.wisvalid(data)

if res:
passed = True
passed_list.append(jsons)
else:
failed_list.append(jsons)

results = {
"result": passed,
"passed_list": passed_list,
"failed_list": failed_list,
}
return results


def main():

args = get_input_args()
candid = find(".json", args.path)
res = evaluate_workflow(candid)
return json.dumps(res)


print(main())

0 comments on commit 8a69948

Please sign in to comment.