Commit 34016ae3 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Moved to version 0.4.4. Improved info api endpoint. Added backend based info...

Moved to version 0.4.4. Improved info api endpoint. Added backend based info to gui, replacing old git info.
parent 8857a5a8
Pipeline #46187 failed with stages
in 12 minutes and 33 seconds
......@@ -16,3 +16,4 @@ target/
*.swp
*.vscode
nomad.yaml
nomad/gitinfo.py
......@@ -34,7 +34,10 @@ build:
before_script:
- git submodule sync
- git submodule update --init
- ./gitinfo.sh
script:
# ignore test directories of dependencies, there is a lot of data that we not use
# in the context of the docker image
- find dependencies -name "*test*" -type d -exec echo "{}/" \; >> .dockerignore
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.mpcdf.mpg.de
- docker build -t $TEST_IMAGE .
......@@ -48,8 +51,6 @@ buildgui:
stage: build
script:
- cd gui
- ./gitinfo.sh
- ls -la src/gitinfo.json
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.mpcdf.mpg.de
- docker build -t $FRONTEND_TEST_IMAGE .
- docker push $FRONTEND_TEST_IMAGE
......
......@@ -55,6 +55,10 @@ your browser.
## Change log
### v0.4.4
- support for multiple domains
- info API endpoint
### v0.4.3
- more flexible celery routing
- config via nomad.yml
......
#!/bin/sh
echo log: str = \'$(git log -1 --oneline)\'\\nref: str = \'$(git describe --all)\'\\nversion: str = \'$(git describe)\' > nomad/gitinfo.py
\ No newline at end of file
......@@ -10,7 +10,6 @@
/build
# generated
src/gitinfo.json
public/metainfo/
# misc
......
#!/bin/sh
echo { \"log\": \"$(git log -1 --oneline)\", \"ref\": \"$(git describe --all)\", \"version\": \"$(git describe)\" } > src/gitinfo.json
\ No newline at end of file
{
"name": "nomad-fair-gui",
"version": "0.1.0",
"version": "0.4.4",
"private": true,
"dependencies": {
"@material-ui/core": "^3.9.0",
......@@ -33,7 +33,6 @@
"url-parse": "^1.4.3"
},
"scripts": {
"gitinfo": "echo \"{ \\\"log\\\": \\\"$(git log -1 --oneline)\\\", \\\"ref\\\": \\\"$(git describe --all)\\\", \\\"version\\\": \\\"$(git describe)\\\" }\" > src/gitinfo.json",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
......
......@@ -2,28 +2,47 @@ import React from 'react'
import PropTypes from 'prop-types'
import { withStyles } from '@material-ui/core/styles'
import Markdown from './Markdown'
import gitInfo from '../gitinfo'
import { kibanaBase, apiBase } from '../config'
import { compose } from 'recompose'
import { withApi } from './api'
class Development extends React.Component {
static propTypes = {
classes: PropTypes.object.isRequired
classes: PropTypes.object.isRequired,
api: PropTypes.object.isRequired,
raiseError: PropTypes.func.isRequired
}
static styles = theme => ({
root: {}
})
state = {
info: null
}
componentDidMount() {
this.props.api.getInfo()
.then(info => this.setState({info: info}))
.catch(error => {
this.props.raiseError(error)
})
}
render() {
const { classes } = this.props
const { info } = this.state
return (
<div className={classes.root}>
<Markdown>{`
### Build info
- version: \`${gitInfo.version}\`
- ref: \`${gitInfo.ref}\`
- last commit message: *${gitInfo.log}*
### Nomad
- version: \`${info ? info.version : 'loading'}/${info ? info.release : 'loading'}\`
- domain: ${info ? info.domain.name : 'loading'}
- git: \`${info ? info.git.ref : 'loading'}; ${info ? info.git.version : 'loading'}\`
- last commit message: *${info ? info.git.log : 'loading'}*
- parsers: ${info ? info.parsers.join(', ') : 'loading'}
- normalizers: ${info ? info.normalizers.join(', ') : 'loading'}
### ReST API
Nomad services can also be accessed programatically via nomad's
......@@ -51,4 +70,4 @@ class Development extends React.Component {
}
}
export default withStyles(Development.styles)(Development)
export default compose(withApi(), withStyles(Development.styles))(Development)
......@@ -88,8 +88,6 @@ class RepoCalcView extends React.Component {
const mainfile = calcData.mainfile
const calcPath = mainfile ? mainfile.substring(0, mainfile.lastIndexOf('/')) : null
console.log(calcData)
const authors = loading ? null : calcData.authors
return (
......
......@@ -271,6 +271,22 @@ class Api {
}
}
_cachedInfo = null
async getInfo() {
if (!this._cachedInfo) {
const loadInfo = async() => {
const client = await this.swaggerPromise
return client.apis.info.get_info()
.catch(this.handleApiError)
.then(response => response.body)
}
this._cachedInfo = await loadInfo()
}
return this._cachedInfo
}
async getUploadCommand() {
const client = await this.swaggerPromise
return client.apis.uploads.get_upload_command()
......
......@@ -18,7 +18,7 @@ API endpoint that deliver backend configuration details.
from flask_restplus import Resource, fields
from nomad import parsing, normalizing, datamodel
from nomad import config, parsing, normalizing, datamodel, gitinfo
from .app import api
......@@ -39,10 +39,19 @@ domain_model = api.model('Domain', {
'metrics_names': fields.List(fields.String)
})
git_info_model = api.model('GitInfo', {
'ref': fields.String,
'version': fields.String,
'log': fields.String
})
info_model = api.model('Info', {
'parsers': fields.List(fields.String),
'normalizers': fields.List(fields.String),
'domain': fields.Nested(model=domain_model)
'domain': fields.Nested(model=domain_model),
'version': fields.String,
'release': fields.String,
'git': fields.Nested(model=git_info_model)
})
......@@ -53,7 +62,19 @@ class InfoResource(Resource):
def get(self):
""" Return information about the nomad backend and its configuration. """
return {
'parsers': [key for key in parsing.parser_dict.keys()],
'parsers': [key[8:] for key in parsing.parser_dict.keys()],
'normalizers': [normalizer.__name__ for normalizer in normalizing.normalizers],
'domain': datamodel.Domain.instance
'domain': {
'name': datamodel.Domain.instance.name,
'quantities': datamodel.Domain.instance.quantities,
'metrics_names': datamodel.Domain.instance.metrics_names,
'aggregations_names': datamodel.Domain.instance.aggregations_names
},
'version': config.version,
'release': config.release,
'git': {
'ref': gitinfo.ref,
'version': gitinfo.version,
'log': gitinfo.log
}
}, 200
......@@ -163,7 +163,7 @@ client = NomadConfig(
url='http://localhost:8000/nomad/api'
)
version = '4.3' # TODO replace with git hash?
version = '0.4.4'
release = 'devel'
domain = 'DFT'
service = 'unknown nomad service'
......
apiVersion: v1
appVersion: "0.4.3"
appVersion: "0.4.4"
description: A Helm chart for Kubernetes that only runs nomad services and uses externally hosted databases.
name: nomad
version: 0.4.3
version: 0.4.4
......@@ -12,7 +12,7 @@ reqs = [str(ir.req) for ir in install_reqs if 'sphinxcontrib.httpdomain' not in
setup(
name='nomad',
version='0.4.3',
version='0.4.4',
description='The nomad@FAIRDI infrastructure python package',
py_modules=['nomad'],
install_requires=reqs,
......
Markdown is supported
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