Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mintproject/wcm
Browse files Browse the repository at this point in the history
  • Loading branch information
mosoriob committed Aug 14, 2019
2 parents 88918b8 + e65dad4 commit c54212c
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 5 deletions.
124 changes: 121 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
```bash
pip install wcm
```


## CLI

`wcm` WINGS Component Manager is a cli utility to `publish` WINGS component to a WINGS instance.
`wcm` WINGS Component Manager is a cli utility to `publish` and `download` WINGS component to a WINGS instance.

```bash
$ wcm --help
Expand All @@ -28,7 +26,9 @@ Options:

Commands:
configure Configure credentials
download Download a component from the wings server.
init Initialize a directory for a new component.
list Lists all the components in the current wings instance
publish Deploy the pacakge to the wcm.
version Show wcm version.
```
Expand Down Expand Up @@ -72,3 +72,121 @@ Options:
-n, --dry-run
--help Show this message and exit.
```

The `download` sub command will download a component from the current wings server.

```bash
$ wcm download --help
Usage: wcm download [OPTIONS] COMPONENT_ID
Download a component from wings server. Data stored in .yaml file and source code downloaded to folder within same directory. file-path can be specified to download into a specific directory

Options:
-p, --profile <profile-name>
-f, --file-path TEXT
--help Show this message and exit.
```

The `list` sub command lists all the component's names from the current wings server

```bash
$ wcm list --help
Usage: wcm list [OPTIONS]
Lists all the components in the current wings instance

Options:
-p, --profile <profile-name>
--help Show this message and exit.
```

## Example usage

Once wcm is installed, configure your credentials to use a wings server

```bash
C:\Users\Admin>wcm configure
WINGS Server URL:
WINGS Export URL: http://localhost:8080
WINGS User: myUsername
WINGS Password:
WINGS Domain: wings-domain
Success

```

Now you can begin using wcm. First list the components on the wings instance you specified on the credentials

```bash
C:\Users\Admin>wcm list
[Economic]
└─┐
├─ economic-v6
├─ economictest-v5
├─ economicnodata-v6
├─ economic-different-data-v6
└─ economicwcmtest

[Hydrological]
└─┐
├─ HAND-1
├─ hand_final-v1
├─ hand-v1
└─ handnodata-v1.0.1

Done
```

Next, you can download one of these components. Let's choose economic-v6. First you need to navigate into the directory you want to download the component to. Alternatively you could also use the -f <filepath> argument to specify a filepath for the component to be downloaded to

```bash
C:\Users\Admin\Desktop\down>ls

C:\Users\Admin\Desktop\down>wcm download economic-v5
2019-08-13 14:52:02,082 root INFO Downloading component
2019-08-13 14:52:02,226 root INFO Generated YAML
2019-08-13 14:52:02,256 root INFO Download complete
Download complete

C:\Users\Admin\Desktop\down>ls
economic-v6
```

When you download a component it comes in three parts. The wings-component.yaml file which stores the components data. The src folder which stores the sorce code. And the data folder, which at the moment is just a placeholder

After downloading the economic-v5 component, you may edit some of the source code. To upload a new version (6.1 in the example), use the publish command

```bash
C:\Users\Admin\Desktop\down>ls
economic-v6.1

C:\Users\Admin\Desktop\down>wcm publish economic-v6.1
2019-08-13 15:04:08,540 root INFO Publishing component
Success

```

Now lets check the list command to make sure it was published

```bash
C:\Users\Admin\Desktop\down>wcm list
[Economic]
└─┐
├─ economic-v6
├─ economictest-v5
├─ economicnodata-v6
├─ economic-different-data-v6
├─ economicwcmtest
└─ economic-v6.1

[Hydrological]
└─┐
├─ HAND-1
├─ hand_final-v1
├─ hand-v1
└─ handnodata-v1.0.1

Done
```

And now the economic-v6.1 component has been uploaded to WINGS


2 changes: 1 addition & 1 deletion src/wcm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = "0.0.6"
__version__ = "0.0.7"
2 changes: 1 addition & 1 deletion src/wcm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def init(component, yes=False):
with Path("wings-component.yml").open("w") as fh:
fh.write(spec)
click.secho(f"Success", fg="green")
except:
except FileNotFoundError:
with Path("wings-component.yaml").open("w") as fh:
fh.write(spec)
click.secho(f"Success", fg="green")
Expand Down
36 changes: 36 additions & 0 deletions src/wcm/_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,21 @@
},
"source": {"type": "string"},
"schemaVersion": {"type": "string"},
"wings": {
"type": ["object"],
"properties": {
"inputs": {"type": "array", "items": {"$ref": "#/definitions/ioData"}},
"outputs": {"type": "array", "items": {"$ref": "#/definitions/ioData"}},
"rules": {"type": ["string","array"]},
"inheritedRules": {"type": ["string", "array"]},
"documentation": {"type": "string"},
"requirement": {"type": "object", "items": {"$ref": "/definitions/requirements"}},
"componentType": {"type": "string"},
"files": {"type": "array", "items": {"type": "string"}},
},
},
},

"definitions": {
"person": {
"type": ["object", "string"],
Expand All @@ -70,6 +84,27 @@
"email": {"type": "string", "format": "email"},
},
},
"ioData": {
"type": ["object"],
"required": ["role", "prefix", "isParam", "type", "dimensionality"],
"properties": {
"role": {"type": "string"},
"prefix": {"type": "string"},
"isParam": {"type": "boolean"},
"type": {"type": "string"},
"dimensionality": {"type": "integer"}
},
},
"requirement": {
"type": ["object"],
"properties": {
"storageGB": {"type": "double"},
"memoryGB": {"type": "double"},
"need64bit": {"type": "boolean"},
"softwareIds": {"type": "array", "items": {"type": "string"}},

},
},
"organization": {
"type": ["object", "string"],
"required": ["name"],
Expand All @@ -79,6 +114,7 @@
},
},
},

}
#Missing extension for variables of each input and variable of each output

Expand Down

0 comments on commit c54212c

Please sign in to comment.