Skip to content

Commit

Permalink
Read inputs from yaml or json
Browse files Browse the repository at this point in the history
  • Loading branch information
figi44 committed Aug 15, 2024
1 parent 5dbe51e commit eaadb33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions ades.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import pyeodh
from dotenv import load_dotenv
from requests import HTTPError
import yaml

load_dotenv()

pyeodh.set_log_level(10)

username = os.getenv("ADES_USER")
token = os.getenv("ADES_TOKEN")
Expand Down Expand Up @@ -41,7 +42,9 @@ def deploy(file, interact):
except HTTPError:
print("Process not found, no need to undeploy.")

# ades.deploy_process(cwl_yaml=cwl_yaml)
proc = ades.deploy_process(cwl_yaml=cwl_yaml)

print(proc.id, proc.description)

if interact:
code.interact(local={**globals(), **locals()})
Expand All @@ -51,15 +54,18 @@ def deploy(file, interact):
@click.argument("wf", default=WF_ID)
@click.option("--inputs", "inputs_file", type=click.Path(exists=True))
@click.option("-i", "interact", help="End in interactive shell", is_flag=True)
def exec(wf: str, inputs_file, interact):
def exec(wf: str, inputs_file: str, interact):
print("ID", wf)

inputs = {}
if inputs_file:
print(f"Loading inputs from {inputs_file}")

with open(inputs_file, "r") as f:
inputs = json.load(f)
if inputs_file.endswith((".yml", ".yaml")):
inputs = yaml.safe_load(f)
else:
inputs = json.load(f)

print("Inputs:")
print(json.dumps(inputs, indent=2))
Expand Down
4 changes: 2 additions & 2 deletions resize-collection.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ schemas:
$graph:
- class: Workflow
id: resize-collection
label: Resize sentinel2ard collection
doc: Resize sentinel2ard collection
label: Resize collection cogs
doc: Resize collection cogs
requirements:
- class: ScatterFeatureRequirement
inputs:
Expand Down

0 comments on commit eaadb33

Please sign in to comment.