Commit 2234eec6 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Merge branch 'v0.8.3' into encyclopedia-api

parents 09afff8d 42f21688
{
"name": "nomad-fair-gui",
"version": "0.8.2",
"version": "0.8.3",
"commit": "e98694e",
"private": true,
"dependencies": {
......
......@@ -8,7 +8,7 @@ window.nomadEnv = {
'matomoUrl': 'https://repository.nomad-coe.eu/fairdi/stat',
'matomoSiteId': '2',
'version': {
"label": "0.8.2",
"label": "0.8.3",
"isBeta": false,
"usesBetaData": false,
"officialUrl": "https://repository.nomad-coe.eu/app/gui"
......
......@@ -17,7 +17,10 @@ class Quantity extends React.Component {
row: PropTypes.bool,
column: PropTypes.bool,
data: PropTypes.object,
quantity: PropTypes.string,
quantity: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func
]),
withClipboard: PropTypes.bool,
ellipsisFront: PropTypes.bool
}
......@@ -79,8 +82,18 @@ class Quantity extends React.Component {
valueClassName = `${valueClassName} ${classes.ellipsisFront}`
}
let value
if (!loading) {
const value = data && quantity && _.get(data, quantity)
if (typeof quantity === 'string') {
value = data && quantity && _.get(data, quantity)
} else {
try {
value = quantity(data)
} catch {
value = undefined
}
}
if (children && children.length !== 0) {
content = children
} else if (value) {
......@@ -95,12 +108,14 @@ class Quantity extends React.Component {
}
}
const useLabel = label || (typeof quantity === 'string' ? quantity : 'MISSING LABEL')
if (row || column) {
return <div className={row ? classes.row : classes.column}>{children}</div>
} else {
return (
<div className={classes.root}>
<Typography noWrap classes={{root: classes.label}} variant="caption">{label || quantity}</Typography>
<Typography noWrap classes={{root: classes.label}} variant="caption">{useLabel}</Typography>
<div className={classes.valueContainer}>
{loading
? <Typography noWrap={noWrap} variant={typography} className={valueClassName}>
......@@ -108,7 +123,7 @@ class Quantity extends React.Component {
</Typography> : content}
{withClipboard
? <CopyToClipboard className={classes.valueAction} text={clipboardContent} onCopy={() => null}>
<Tooltip title={`Copy ${label || quantity} to clipboard`}>
<Tooltip title={`Copy ${useLabel} to clipboard`}>
<div>
<IconButton disabled={!clipboardContent} classes={{root: classes.valueActionButton}} >
<ClipboardIcon classes={{root: classes.valueActionIcon}}/>
......
import React from 'react'
import PropTypes from 'prop-types'
import { Typography } from '@material-ui/core'
import { Typography, Button, makeStyles, Tooltip } from '@material-ui/core'
import Quantity from '../Quantity'
import _ from 'lodash'
import {appBase} from '../../config'
export default class DFTEntryOverview extends React.Component {
static propTypes = {
data: PropTypes.object.isRequired,
loading: PropTypes.bool
const useStyles = makeStyles(theme => ({
actions: {
marginTop: theme.spacing(1),
textAlign: 'right',
margin: -theme.spacing(1)
}
}))
render() {
const { data } = this.props
export default function DFTEntryOverview(props) {
const classes = useStyles()
const {data} = props
if (!data.dft) {
return <Typography color="error">No metadata available</Typography>
}
if (!data.dft) {
return <Typography color="error">No metadata available</Typography>
}
const material_name = entry => entry.encyclopedia.material.material_name
return (
<Quantity column>
<Quantity row>
<Quantity quantity="formula" label='formula' noWrap {...this.props} />
</Quantity>
<Quantity row>
<Quantity quantity="dft.code_name" label='dft code' noWrap {...this.props} />
<Quantity quantity="dft.code_version" label='dft code version' noWrap {...this.props} />
</Quantity>
<Quantity row>
<Quantity quantity="dft.basis_set" label='basis set' noWrap {...this.props} />
<Quantity quantity="dft.xc_functional" label='xc functional' noWrap {...this.props} />
</Quantity>
<Quantity row>
<Quantity quantity="dft.system" label='system type' noWrap {...this.props} />
<Quantity quantity="dft.crystal_system" label='crystal system' noWrap {...this.props} />
<Quantity quantity="dft.spacegroup_symbol" label="spacegroup" noWrap {...this.props}>
<Typography noWrap>
{_.get(data, 'dft.spacegroup_symbol')} ({_.get(data, 'dft.spacegroup')})
</Typography>
</Quantity>
return <div>
<Quantity column>
<Quantity row>
<Quantity quantity="formula" label='formula' noWrap {...props} />
<Quantity quantity={material_name} label='material name' noWrap {...props} />
</Quantity>
<Quantity row>
<Quantity quantity="dft.code_name" label='dft code' noWrap {...props} />
<Quantity quantity="dft.code_version" label='dft code version' noWrap {...props} />
</Quantity>
<Quantity row>
<Quantity quantity="dft.basis_set" label='basis set' noWrap {...props} />
<Quantity quantity="dft.xc_functional" label='xc functional' noWrap {...props} />
</Quantity>
<Quantity row>
<Quantity quantity="dft.system" label='system type' noWrap {...props} />
<Quantity quantity="dft.crystal_system" label='crystal system' noWrap {...props} />
<Quantity quantity="dft.spacegroup_symbol" label="spacegroup" noWrap {...props}>
<Typography noWrap>
{_.get(data, 'dft.spacegroup_symbol')} ({_.get(data, 'dft.spacegroup')})
</Typography>
</Quantity>
</Quantity>
)
}
</Quantity>
{data.encyclopedia && data.encyclopedia.material &&
<div className={classes.actions}>
<Tooltip title="Show the material of this entry in the NOMAD Encyclopedia.">
<Button color="primary" href={`${appBase}/encyclopedia/#/material/${data.encyclopedia.material.material_id}`}>
material
</Button>
</Tooltip>
</div>
}
</div>
}
DFTEntryOverview.propTypes = {
data: PropTypes.object.isRequired
}
......@@ -138,11 +138,10 @@ class RepoEntryView extends React.Component {
<CardContent classes={{root: classes.cardContent}}>
<Quantity column style={{maxWidth: 350}}>
<Quantity quantity="calc_id" label={`${domain ? domain.entryLabel : 'entry'} id`} noWrap withClipboard {...quantityProps} />
<Quantity quantity="pid" label='PID' loading={loading} placeholder="not yet assigned" noWrap {...quantityProps} withClipboard />
<Quantity quantity={entry => entry.encyclopedia.material.material_id} label='material id' loading={loading} noWrap {...quantityProps} withClipboard />
<Quantity quantity="raw_id" label='raw id' loading={loading} noWrap {...quantityProps} withClipboard />
<Quantity quantity="external_id" label='external id' loading={loading} noWrap {...quantityProps} withClipboard />
<Quantity quantity="mainfile" loading={loading} noWrap ellipsisFront {...quantityProps} withClipboard />
<Quantity quantity="calc_hash" label={`${domain ? domain.entryLabel : 'entry'} hash`} loading={loading} noWrap {...quantityProps} />
<Quantity quantity="upload_id" label='upload id' {...quantityProps} noWrap withClipboard />
<Quantity quantity="upload_time" label='upload time' noWrap {...quantityProps} >
<Typography noWrap>
......
......@@ -18,7 +18,7 @@ export const matomo = matomoEnabled ? PiwikReactRouter({
siteId: matomoSiteId,
clientTrackerName: 'stat.js',
serverTrackerName: 'stat'
}) : null
}) : []
const keycloak = Keycloak({
url: keycloakBase,
......
......@@ -20,7 +20,8 @@ from typing import Dict, Any
from flask_restplus import Resource, fields
from datetime import datetime
from nomad import config, parsing, normalizing, datamodel, gitinfo, search
from nomad import config, normalizing, datamodel, gitinfo, search
from nomad.parsing import parsers, MatchingParser
from .api import api
......@@ -94,8 +95,8 @@ class InfoResource(Resource):
def get(self):
''' Return information about the nomad backend and its configuration. '''
codes_dict = {}
for parser in parsing.parser_dict.values():
if isinstance(parser, parsing.MatchingParser) and parser.domain == 'dft':
for parser in parsers.parser_dict.values():
if isinstance(parser, MatchingParser) and parser.domain == 'dft':
code_name = parser.code_name
if code_name in codes_dict:
continue
......@@ -105,10 +106,10 @@ class InfoResource(Resource):
return {
'parsers': [
key[key.index('/') + 1:]
for key in parsing.parser_dict.keys()],
for key in parsers.parser_dict.keys()],
'metainfo_packages': ['general', 'general.experimental', 'common', 'public'] + sorted([
key[key.index('/') + 1:]
for key in parsing.parser_dict.keys()]),
for key in parsers.parser_dict.keys()]),
'codes': codes,
'normalizers': [normalizer.__name__ for normalizer in normalizing.normalizers],
'statistics': statistics(),
......
......@@ -22,7 +22,7 @@ import importlib
from nomad.metainfo.legacy import python_package_mapping, LegacyMetainfoEnvironment
from nomad.metainfo import Package
from nomad.parsing import parsers
from nomad.parsing.parsers import parsers
from .api import api
......
......@@ -36,6 +36,7 @@ lazy_import.lazy_module('nomad.config')
lazy_import.lazy_module('nomad.infrastructure')
lazy_import.lazy_module('nomad.utils')
lazy_import.lazy_module('nomad.parsing')
lazy_import.lazy_module('nomad.parsing.parsers')
lazy_import.lazy_module('nomad.normalizing')
lazy_import.lazy_module('nomad.datamodel')
lazy_import.lazy_module('nomad.search')
......@@ -46,5 +47,5 @@ lazy_import.lazy_module('nomad.client')
lazy_import.lazy_module('nomadcore')
lazy_import.lazy_module('nomadcore.simple_parser')
from . import dev, parse, admin, client # noqa
from . import dev, admin, parse, client # noqa
from .cli import run_cli, cli # noqa
......@@ -45,6 +45,7 @@ lazy_import.lazy_module('nomad.files')
lazy_import.lazy_module('nomad.search')
lazy_import.lazy_module('nomad.datamodel')
lazy_import.lazy_module('nomad.parsing')
lazy_import.lazy_module('nomad.parsing.parsers')
lazy_import.lazy_module('nomad.infrastructure')
lazy_import.lazy_module('nomad.doi')
lazy_import.lazy_module('nomad.client')
......
......@@ -4,10 +4,8 @@ import json
import click
import sys
from nomad import utils
from nomad import parsing
from nomad import normalizing
from nomad import datamodel
from nomad import utils, parsing, normalizing, datamodel
import nomadcore
from .cli import cli
......@@ -22,15 +20,16 @@ def parse(
Run the given parser on the downloaded calculation. If no parser is given,
do parser matching and use the respective parser.
'''
from nomad.parsing import parsers
mainfile = os.path.basename(mainfile_path)
if logger is None:
logger = utils.get_logger(__name__)
if parser_name is not None:
parser = parsing.parser_dict.get(parser_name)
parser = parsers.parser_dict.get(parser_name)
assert parser is not None, 'the given parser must exist'
else:
parser = parsing.match_parser(mainfile_path, strict=strict)
parser = parsers.match_parser(mainfile_path, strict=strict)
if isinstance(parser, parsing.MatchingParser):
parser_name = parser.name
else:
......
......@@ -262,7 +262,7 @@ datacite = NomadConfig(
)
meta = NomadConfig(
version='0.8.2',
version='0.8.3',
commit=gitinfo.commit,
release='devel',
default_domain='dft',
......
......@@ -266,7 +266,7 @@ class DFTMetadata(MSection):
def code_name_from_parser(self):
entry = self.m_parent
if entry.parser_name is not None:
from nomad.parsing import parser_dict
from nomad.parsing.parsers import parser_dict
parser = parser_dict.get(entry.parser_name)
if hasattr(parser, 'code_name'):
return parser.code_name
......
This diff is collapsed.
This diff is collapsed.
......@@ -38,7 +38,8 @@ from structlog.processors import StackInfoRenderer, format_exc_info, TimeStamper
from nomad import utils, config, infrastructure, search, datamodel
from nomad.files import PathObject, UploadFiles, ExtractError, ArchiveBasedStagingUploadFiles, PublicUploadFiles, StagingUploadFiles
from nomad.processing.base import Proc, process, task, PENDING, SUCCESS, FAILURE
from nomad.parsing import parser_dict, match_parser, Backend
from nomad.parsing import Backend
from nomad.parsing.parsers import parser_dict, match_parser
from nomad.normalizing import normalizers
from nomad.datamodel import EntryArchive
from nomad.archive import query_archive
......@@ -456,7 +457,10 @@ class Calc(Proc):
self._entry_metadata.dft.update_group_hash()
except Exception as e:
logger.error("Could not retrieve method information for phonon calculation.", exception=e)
if self._entry_metadata.encyclopedia is None:
self._entry_metadata.encyclopedia = EncyclopediaMetadata()
self._entry_metadata.encyclopedia.status = EncyclopediaMetadata.status.type.failure
finally:
# persist the calc metadata
with utils.timer(logger, 'saved calc metadata', step='metadata'):
......@@ -1036,8 +1040,8 @@ class Upload(Proc):
modified_upload = self._get_collection().find_one_and_update(
{'_id': self.upload_id, 'joined': {'$ne': True}},
{'$set': {'joined': True}})
if modified_upload is not None:
self.get_logger().debug('join')
if modified_upload is None or modified_upload['joined'] is False:
self.get_logger().info('join')
# Before cleaning up, run an additional normalizer on phonon
# calculations. TODO: This should be replaced by a more
......
apiVersion: v1
appVersion: "0.8.1"
appVersion: "0.8.3"
description: A Helm chart for Kubernetes that only runs nomad services and uses externally hosted databases.
name: nomad
version: 0.8.2
version: 0.8.3
## Default values for nomad@FAIRDI
version:
label: "0.8.2"
label: "0.8.3"
isBeta: false
usesBetaData: false
officialUrl: "https://repository.nomad-coe.eu/app/gui"
......
......@@ -3,7 +3,7 @@ if __name__ == '__main__':
import logging
import time
from nomad import config, utils
from nomad.parsing import parser_dict
from nomad.parsing.parsers import parser_dict
from nomad.cli.parse import normalize_all
from nomad.metainfo.legacy import LegacyMetainfoEnvironment
from nomad.parsing.legacy import Backend
......
......@@ -22,7 +22,8 @@ import datetime
from ase.data import chemical_symbols
from ase.spacegroup import Spacegroup
from nomad import datamodel, parsing, utils, files
from nomad import datamodel, utils, files
from nomad.parsing.parsers import parser_dict
number_of = 20
......@@ -37,7 +38,7 @@ systems = ['atom', 'molecule/cluster', '2D/surface', 'bulk']
comments = [gen.sentence() for _ in range(0, number_of)]
references = [(i + 1, gen.url()) for i in range(0, number_of)]
datasets = [(i + 1, gen.slug()) for i in range(0, number_of)]
codes = list(set([parser.code_name for parser in parsing.parser_dict.values() if hasattr(parser, 'code_name')])) # type: ignore
codes = list(set([parser.code_name for parser in parser_dict.values() if hasattr(parser, 'code_name')])) # type: ignore
filepaths = ['/'.join(gen.url().split('/')[3:]) for _ in range(0, number_of)]
low_numbers_for_atoms = [1, 1, 2, 2, 2, 2, 2, 3, 3, 4]
......
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