Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename impl ompl #456

Merged
merged 16 commits into from
Feb 22, 2024
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ Then installing some models:
npm install -g "@grnsft/if-models"
```

Then create an `impl` file that describes your application (see our docs for a detailed explanation).
Then create an `manifest` file that describes your application (see our docs for a detailed explanation).

Then, run `impact-engine` using the following command:
Then, run `if` using the following command:

```sh
impact-engine --impl <path-to-your-impl-file>
if --manifest <path-to-your-manifest-file>
```

You can also add an optional savepath for your output yaml (if you do not provide one, the output will be printed to the console):

```sh
impact-engine --impl <path-to-your-impl-file> --ompl <your-savepath>
if --manifest <path-to-your-manifest-file> --output <your-savepath>
```

The `impact-engine` CLI tool will configure and run the models defined in your input `yaml` (`impl`) and return the results as an output `yaml` (`ompl`).
The `if` CLI tool will configure and run the models defined in your input `yaml` (`manifest`) and return the results as an output `yaml` (`output`).


## Documentation
Expand All @@ -79,7 +79,7 @@ Please read our documentation at [if.greensoftware.foundation](https://if.greens

## Video walk-through

Watch this video to learn how to create and run an `impl`.
Watch this video to learn how to create and run a `manifest`.

[![Watch the walk-through video](https://i3.ytimg.com/vi/R-6eDM8AsvY/maxresdefault.jpg)](https://youtu.be/GW37Qd4AQbU)

Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
},
modulePathIgnorePatterns: [
'./build',
'./src/__tests__/unit/lib/impls',
'./src/__tests__/unit/lib/manifest',
'./src/__tests__/integration/helpers',
'./src/__tests__/integration/test-data',
],
Expand Down
2 changes: 1 addition & 1 deletion scripts/impact-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ do
echo ""
echo executing $file, outfile is ${file#"$prefix"}
echo ""
npx ts-node impact-engine.ts --impl $file --ompl examples/ompls/${file#"$prefix"}
npx ts-node ./src --manifest $file --output examples/ompls/${file#"$prefix"}
done
exit 0
4 changes: 2 additions & 2 deletions scripts/run-yamls.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
echo 'Running all impls'
echo 'Running all manifests'


for f in ./examples/impls/test/*.yml; do
echo "Processing $f file...";
npm run impact-engine -- --impl $f
npm run if -- --manifest $f
done
79 changes: 0 additions & 79 deletions src/__mocks__/model-universe/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Impl} from '../../../../types/impl';
import {Manifest} from '../../../../types/manifest';

export const impl: Impl = {
export const manifest: Manifest = {
name: 'gsf-demo',
description: 'Hello',
tags: {
Expand All @@ -9,19 +9,18 @@ export const impl: Impl = {
category: 'cloud',
},
initialize: {
models: [
{
name: 'mock-name',
plugins: {
'mock-name': {
model: 'MockaviztaModel',
path: 'mock-path',
config: {
'global-config': {
allocation: 'LINEAR',
verbose: true,
},
},
],
},
},
graph: {
tree: {
children: {
'front-end': {
pipeline: ['mock-name'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Impl} from '../../../../types/impl';
import {Manifest} from '../../../../types/manifest';

export const implNested: Impl = {
export const manifestNested: Manifest = {
name: 'nesting-demo',
description: null,
tags: {
Expand All @@ -9,19 +9,18 @@ export const implNested: Impl = {
category: 'on-premise',
},
initialize: {
models: [
{
name: 'mockavizta',
plugins: {
mockavizta: {
model: 'MockaviztaModel',
path: 'mock-path',
config: {
'global-config': {
allocation: 'LINEAR',
verbose: true,
},
},
],
},
},
graph: {
tree: {
children: {
'child-0': {
config: {
Expand Down Expand Up @@ -76,7 +75,7 @@ export const implNested: Impl = {
},
};

export const implNestedNoConfig: Impl = {
export const manifestNestedNoConfig: Manifest = {
name: 'nesting-demo',
description: null,
tags: {
Expand All @@ -85,19 +84,18 @@ export const implNestedNoConfig: Impl = {
category: 'on-premise',
},
initialize: {
models: [
{
name: 'mockavizta',
plugins: {
mockavizta: {
model: 'MockaviztaModel',
path: 'mock-path',
config: {
'global-config': {
allocation: 'LINEAR',
verbose: true,
},
},
],
},
},
graph: {
tree: {
children: {
'child-0': {
config: {
Expand Down
40 changes: 20 additions & 20 deletions src/__tests__/unit/util/args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ jest.mock('ts-command-line-args', () => ({
switch (process.env.result) {
case 'error':
return {};
case 'impl':
case 'manifest':
return {
impl: 'impl-mock.yml',
manifest: 'manifest-mock.yml',
};
case 'impl-ompl':
case 'manifest-output':
return {
impl: 'impl-mock.yml',
ompl: 'ompl-mock.yml',
manifest: 'manifest-mock.yml',
output: 'output-mock.yml',
};
case 'help':
return {
help: true,
};
case 'not-yaml':
return {
impl: 'mock.notyaml',
manifest: 'mock.notyaml',
};
default:
return {
impl: 'mock-impl.yaml',
ompl: 'mock-ompl',
manifest: 'mock-manifest.yaml',
output: 'mock-output',
};
}
},
Expand All @@ -39,7 +39,7 @@ import {STRINGS} from '../../../config';

const {CliInputError} = ERRORS;

const {IMPL_IS_MISSING, FILE_IS_NOT_YAML} = STRINGS;
const {MANIFEST_IS_MISSING, FILE_IS_NOT_YAML} = STRINGS;

describe('util/args: ', () => {
const originalEnv = process.env;
Expand All @@ -55,40 +55,40 @@ describe('util/args: ', () => {
} catch (error) {
if (error instanceof Error) {
expect(error).toBeInstanceOf(CliInputError);
expect(error.message).toEqual(IMPL_IS_MISSING);
expect(error.message).toEqual(MANIFEST_IS_MISSING);
}
}
});

it('returns impl path.', () => {
it('returns manifest path.', () => {
expect.assertions(1);

process.env.result = 'impl';
process.env.result = 'manifest';

const result = parseArgs();
const processRunningPath = process.cwd();

const implPath = 'impl-mock.yml';
const manifestPath = 'manifest-mock.yml';
const expectedResult = {
inputPath: path.normalize(`${processRunningPath}/${implPath}`),
inputPath: path.normalize(`${processRunningPath}/${manifestPath}`),
};

expect(result).toEqual(expectedResult);
});

it('returns impl and ompl path.', () => {
it('returns manifest and output path.', () => {
expect.assertions(1);

process.env.result = 'impl-ompl';
process.env.result = 'manifest-output';

const result = parseArgs();
const processRunningPath = process.cwd();

const implPath = 'impl-mock.yml';
const omplPath = 'ompl-mock.yml';
const manifestPath = 'manifest-mock.yml';
const outputPath = 'output-mock.yml';
const expectedResult = {
inputPath: path.normalize(`${processRunningPath}/${implPath}`),
outputPath: path.normalize(`${processRunningPath}/${omplPath}`),
inputPath: path.normalize(`${processRunningPath}/${manifestPath}`),
outputPath: path.normalize(`${processRunningPath}/${outputPath}`),
};

expect(result).toEqual(expectedResult);
Expand Down
20 changes: 10 additions & 10 deletions src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import {ArgumentConfig} from 'ts-command-line-args';

import {impactProcessArgs} from '../types/process-args';
import {ManifestProcessArgs} from '../types/process-args';

export const CONFIG = {
impact: {
ARGS: {
impl: {
manifest: {
type: String,
optional: true,
alias: 'i',
description: 'Path to an input IMPL file.',
description: 'Path to an input manifest file.',
},
ompl: {
output: {
type: String,
optional: true,
description:
'Path to the output IMPL file where the results as saved, if none is provided it prints to stdout.',
'Path to the output file where the results as saved, if none is provided it prints to stdout.',
},
'override-params': {
type: String,
Expand All @@ -41,15 +41,15 @@ export const CONFIG = {
alias: 'h',
description: 'Prints this usage guide.',
},
} as ArgumentConfig<impactProcessArgs>,
} as ArgumentConfig<ManifestProcessArgs>,
HELP: `impact
-impl [path to the input impl file]
-ompl [path to the output impl file]
-manifest [path to the input file]
-output [path to the output file]
-format [yaml|csv]
-verbose
-help
impl: path to an input IMPL file
ompl: path to the output IMPL file where the results as saved, if none is provided it prints to stdout.
manifest: path to an input manifest
output: path to the output file where the results as saved, if none is provided it prints to stdout.
format: the output file format. default to yaml but if csv is specified then it formats the outputs as a csv file for loading into another program.
verbose: how much information to output about the calculation to aid investigation and debugging.
help: prints out the above help instruction.
Expand Down
4 changes: 2 additions & 2 deletions src/config/strings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const STRINGS = {
FILE_IS_NOT_YAML: 'Provided impl file is not in yaml format.',
IMPL_IS_MISSING: 'Impl file is missing.',
FILE_IS_NOT_YAML: 'Provided manifest is not in yaml format.',
MANIFEST_IS_MISSING: 'Manifest is missing.',
MISSING_CLASSNAME: "Initalization param 'model' is missing.",
MISSING_PATH: "Initalization param 'path' is missing.",
OVERRIDE_WARNING:
Expand Down
Loading
Loading