Skip to content

Commit

Permalink
Merge pull request #149 from aiidalab/release/1.0.0b13
Browse files Browse the repository at this point in the history
Release/1.0.0b13
  • Loading branch information
yakutovicha committed Nov 5, 2020
2 parents efad328 + ce1f803 commit a082c22
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion aiidalab_widgets_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
from .structures_multi import MultiStructureUploadWidget
from .viewers import viewer

__version__ = "1.0.0b12"
__version__ = "1.0.0b13"
5 changes: 4 additions & 1 deletion aiidalab_widgets_base/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class OptimadeQueryWidget(ipw.VBox):
:class:`aiidalab_widgets_base.structures.StructureManagerWidget`,
embedded into applications.
NOTE: `embedded` for `OptimadeQueryFilterWidget` was introduced in `optimade-client`
version 2020.11.5.
:param embedded: Whether or not to show extra database and provider information.
When set to `True`, the extra information will be hidden, this is useful
in situations where the widget is used in a Tab or similar, e.g., for the
Expand All @@ -141,7 +144,7 @@ def __init__(
**kwargs,
) -> None:
providers = OptimadeQueryProviderWidget(embedded=embedded)
filters = OptimadeQueryFilterWidget()
filters = OptimadeQueryFilterWidget(embedded=embedded)

ipw.dlink((providers, 'database'), (filters, 'database'))

Expand Down
28 changes: 19 additions & 9 deletions aiidalab_widgets_base/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import pandas as pd
import ipywidgets as ipw
from IPython.display import HTML, Javascript, clear_output, display
from traitlets import Instance, Int, List, Unicode, Union, observe, validate
from traitlets import Instance, Int, List, Unicode, Union, default, observe, validate

# AiiDA imports.
from aiida.engine import submit, Process, ProcessBuilder
from aiida.orm import CalcFunctionNode, CalcJobNode, Node, ProcessNode, WorkChainNode, WorkFunctionNode, load_node
from aiida.cmdline.utils.common import get_calcjob_report, get_workchain_report, get_process_function_report
from aiida.cmdline.utils.ascii_vis import format_call_graph
from aiida.cmdline.utils.query.calculation import CalculationQueryBuilder
from aiida.common.exceptions import MultipleObjectsError, NotExistent
from aiida.common.exceptions import MultipleObjectsError, NotExistent, NotExistentAttributeError

# Local imports.
from .viewers import viewer
Expand Down Expand Up @@ -410,15 +410,21 @@ def update(self):
if self.calculation is None:
return

output_file_path = None
if 'remote_folder' in self.calculation.outputs:
try:
output_file_path = os.path.join(self.calculation.outputs.remote_folder.get_remote_path(),
self.calculation.attributes['output_filename'])
if output_file_path and os.path.exists(output_file_path):
with open(output_file_path) as fobj:
difference = fobj.readlines()[len(self.output):-1] # Only adding the difference
self.output += difference
self.value += ''.join(difference)
except KeyError:
self.placeholder = "The `output_filename` attribute is not set for " \
f"{self.calculation.process_class}. Nothing to show."
except NotExistentAttributeError:
self.placeholder = "The object `remote_folder` was not found among the process outputs. " \
"Nothing to show."
else:
if os.path.exists(output_file_path):
with open(output_file_path) as fobj:
difference = fobj.readlines()[len(self.output):-1] # Only adding the difference
self.output += difference
self.value += ''.join(difference)

# Auto scroll down. Doesn't work in detached mode.
# Also a hack as it is applied to all the textareas
Expand Down Expand Up @@ -572,6 +578,10 @@ def _validate_outgoing_node(self, provided):
return None
return None

@default('process_label')
def _default_process_label(self):
return None

@validate('process_label')
def _validate_process_label(self, provided):
if provided['value']:
Expand Down
17 changes: 16 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@
"authors": "AiiDA Team",
"version": "1.0.0a5",
"logo": "miscellaneous/logos/aiidalab.png",
"state": "stable"
"state": "stable",
"requires": {
"~=1.0b": [
"aiida-core>=1.0.0,<2.0.0",
"ase",
"bokeh",
"fileupload",
"ipywidgets",
"more_itertools",
"nglview",
"numpy",
"optimade-client",
"pandas",
"scikit-learn"
]
}
}
3 changes: 2 additions & 1 deletion setup.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.0b12",
"version": "1.0.0b13",
"name": "aiidalab-widgets-base",
"author_email": "aiidalab@materialscloud.org",
"url": "https://github.com/aiidalab/aiidalab-widgets-base",
Expand All @@ -19,6 +19,7 @@
"more_itertools",
"nglview",
"numpy",
"optimade-client",
"pandas",
"scikit-learn"
],
Expand Down

0 comments on commit a082c22

Please sign in to comment.