Skip to content
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Ignore magic commands in input notebooks (#14)
* Add NDVI sample notebook
* Improve STAC output
* Tweak CWL format (#24)

## Changes in 0.1.0

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- nbconvert
- nbformat
- pystac
- pyyaml
- pyyaml >=5.1 # need >=5.1 for sort_keys
- xarray
- xcube # See note below
# test dependencies
Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic/dynamic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"tags": []
},
"source": [
"This notebook creates two simple synthetic datasets which are generated on the fly by xcube. It can be converted to a compute engine container using the `xcetool`."
"This notebook creates two simple synthetic datasets which are generated on the fly by xcube. It can be converted to a compute engine container using `xcetool`."
]
},
{
Expand Down
6 changes: 5 additions & 1 deletion xcengine/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ def build(
)
image = image_builder.build()
if eoap:
eoap.write_text(yaml.dump(image_builder.create_cwl()))
class IndentDumper(yaml.Dumper):
def increase_indent(self, flow=False, indentless=False):
return super(IndentDumper, self).increase_indent(flow, False)

eoap.write_text(yaml.dump(image_builder.create_cwl(), sort_keys=False, Dumper=IndentDumper))
print(f"Built image with tags {image.tags}")


Expand Down
13 changes: 8 additions & 5 deletions xcengine/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def process_params_cell(self) -> None:

def create_cwl(self, image_tag: str) -> dict[str, Any]:
script_id = "xce_script"
output_id = "xce_output"
output_id = "results"
return {
"cwlVersion": "v1.2",
"cwlVersion": "v1.0",
"$namespaces": {"s": "https://schema.org/"},
"s:softwareVersion": "1.0.0",
"schemas": [
Expand All @@ -118,16 +118,16 @@ def create_cwl(self, image_tag: str) -> dict[str, Any]:
"$graph": [
{
"class": "Workflow",
"id": "xcengine_ap",
"label": "xcengine notebook",
"doc": "xcengine notebook",
"id": "main",
"requirements": [],
"inputs": self.nb_params.get_cwl_workflow_inputs(),
"outputs": [
{
"id": "stac_catalog",
"outputSource": [f"run_script/{output_id}"],
"type": "Directory",
"outputSource": [f"run_script/{output_id}"],
}
],
"steps": {
Expand All @@ -144,6 +144,9 @@ def create_cwl(self, image_tag: str) -> dict[str, Any]:
"requirements": {
"DockerRequirement": {"dockerPull": image_tag}
},
"hints": {
"DockerRequirement": {"dockerPull": image_tag}
},
"baseCommand": [
"python3",
"/home/mambauser/execute.py",
Expand All @@ -153,8 +156,8 @@ def create_cwl(self, image_tag: str) -> dict[str, Any]:
"inputs": self.nb_params.get_cwl_commandline_inputs(),
"outputs": {
output_id: {
"outputBinding": {"glob": "."},
"type": "Directory",
"outputBinding": {"glob": "."},
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions xcengine/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ def get_cwl_commandline_inputs(self) -> dict[str, dict[str, Any]]:
def get_cwl_workflow_input(self, var_name: str) -> dict[str, Any]:
type_, default_ = self.params[var_name]
return {
"label": var_name,
"doc": var_name,
"type": self.cwl_type(type_),
"default": default_,
"doc": var_name,
"label": var_name,
}

def get_cwl_commandline_input(self, var_name: str) -> dict[str, Any]:
Expand Down