Commit f8bd3ad1 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[environments] integrate with beat.core env support to provide actual local env info, #77

parent 00ccee1d
......@@ -45,6 +45,9 @@ logger = logging.getLogger(__name__)
from . import utils
from beat.core.dock import Host
from beat.core.environments import enumerate_packages
class Layout(Resource):
"""Exposes toolchain layout functionality"""
......@@ -69,52 +72,17 @@ class Environments(Resource):
"""Exposes local environment info"""
def get(self):
return [
{
"name": "Scientific Python 2.7",
"packages": {
"alabaster": "0.7.6",
"babel": "1.3"
},
"queues": {
"Default": {
"memory_limit": 5983,
"nb_slots": 2,
"max_slots_per_user": 2,
"nb_cores_per_slot": 1,
"time_limit": 360
}
},
"accessibility": "public",
"languages": [
"python"
],
"version": "0.0.4",
"short_description": "Scientific Python 2.7"
},
{
"name": "Scientific Python 2.7",
"packages": {
"alabaster": "0.7.10",
"Babel": "2.4.0"
},
"queues": {
"Default": {
"memory_limit": 5983,
"nb_slots": 2,
"max_slots_per_user": 2,
"nb_cores_per_slot": 1,
"time_limit": 360
}
},
"accessibility": "public",
"languages": [
"python"
],
"version": "1.0.0",
"short_description": "Scientific Python 2.7"
}
]
"""Uses beat.core to get the local environment (docker) information
and returns a list of environments"""
host = Host()
envs = host.processing_environments
for env in envs.keys():
envs[env]['queues'] = {}
try:
envs[env]['packages'] = enumerate_packages(host, env)
except:
envs[env]['packages'] = []
return envs
class Templates(Resource):
......
......@@ -288,6 +288,7 @@ const EnvironmentConfig = ({ envInfo, queue, availableEnvs, updateEnvInfo, updat
}
</Input>
</Col>
{ Array.isArray(queues) && queues.length > 0 &&
<Col>
<Label>
<InfoTooltip
......@@ -306,12 +307,13 @@ const EnvironmentConfig = ({ envInfo, queue, availableEnvs, updateEnvInfo, updat
disabled={disabled}
>
{
(queues || []).map((queue, i) =>
(queues).map((queue, i) =>
<option key={i} value={queue}>{ queue }</option>
)
}
</Input>
</Col>
}
</FormGroup>
);
};
......@@ -1101,6 +1103,7 @@ export class ExperimentEditor extends React.Component<Props, State> {
...this.state.cache.contents.globals.environment,
name,
version,
queue: '',
}
}
})}
......
......@@ -96,9 +96,7 @@ const environments = (state: BeatEnvironment[] = [], action: Action) => {
const {type, payload} = action;
switch(type){
case 'SAVE_ENVIRONMENTS':
return [
...payload,
];
return payload;
default:
throw new Error(`Invalid actionType "${ type }"`);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment