Skip to content

Commit

Permalink
Release/1.0.0rc4 (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha committed Sep 17, 2021
2 parents eddeb9a + 364243b commit 3c509a5
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 78 deletions.
2 changes: 1 addition & 1 deletion aiidalab_widgets_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@
"viewer",
]

__version__ = "1.0.0rc3"
__version__ = "1.0.0rc4"
16 changes: 9 additions & 7 deletions aiidalab_widgets_base/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def __init__(
setup_code_params[key] = value

# For later: use base_url here, when it will be implemented in the appmode.
url_string = f"<a href={path_to_root}aiidalab-widgets-base/setup_code.ipynb?"
url_string = (
f"<a href={path_to_root}aiidalab-widgets-base/notebooks/setup_code.ipynb?"
)
url_string += "&".join(
[f"{k}={v}".replace(" ", "%20") for k, v in setup_code_params.items()]
)
Expand Down Expand Up @@ -101,7 +103,7 @@ def _get_codes(self):

@staticmethod
def _full_code_label(code):
return f"{code.label}@{code.computer.name}"
return f"{code.label}@{code.computer.label}"

def refresh(self, _=None):
"""Refresh available codes.
Expand All @@ -123,7 +125,7 @@ def refresh(self, _=None):

@validate("selected_code")
def _validate_selected_code(self, change):
"""If code is provided, set it as it is. If code's name is provided,
"""If code is provided, set it as it is. If code's label is provided,
select the code and set it."""
code = change["value"]
self.output.value = ""
Expand All @@ -132,7 +134,7 @@ def _validate_selected_code(self, change):
if code is None:
return None

# Check code by name.
# Check code by label.
if isinstance(code, str):
if code in self.codes:
return self.codes[code]
Expand Down Expand Up @@ -254,7 +256,7 @@ def _setup_code(self, _=None):
print("You did not specify absolute path to the executable")
return
if self.exists():
print(f"Code {self.label}@{self.computer.name} already exists")
print(f"Code {self.label}@{self.computer.label} already exists")
return
code = Code(remote_computer_exec=(self.computer, self.remote_abs_path))
code.label = self.label
Expand All @@ -264,15 +266,15 @@ def _setup_code(self, _=None):
code.set_append_text(self.append_text)
code.store()
code.reveal()
full_string = f"{self.label}@{self.computer.name}"
full_string = f"{self.label}@{self.computer.label}"
print(check_output(["verdi", "code", "show", full_string]).decode("utf-8"))

def exists(self):
"""Returns True if the code exists, returns False otherwise."""
from aiida.common import MultipleObjectsError, NotExistent

try:
Code.get_from_string(f"{self.label}@{self.computer.name}")
Code.get_from_string(f"{self.label}@{self.computer.label}")
return True
except MultipleObjectsError:
return True
Expand Down
14 changes: 7 additions & 7 deletions aiidalab_widgets_base/computers.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def _configure_computer(self):
from aiida.orm import AuthInfo

authinfo = AuthInfo(
computer=Computer.objects.get(name=self.label), user=aiidauser
computer=Computer.objects.get(label=self.label), user=aiidauser
)
authinfo.set_auth_params(authparams)
authinfo.store()
Expand All @@ -764,15 +764,15 @@ def _on_setup_computer(self, _=None):
print("Please specify the computer name (for AiiDA)")
return
try:
computer = Computer.objects.get(name=self.label)
computer = Computer.objects.get(label=self.label)
print(f"A computer called {self.label} already exists.")
return
except NotExistent:
pass

print(f"Creating new computer with name '{self.label}'")
computer = Computer(
name=self.label, hostname=self.hostname, description=self.description
label=self.label, hostname=self.hostname, description=self.description
)
computer.set_transport_type(self.transport)
computer.set_scheduler_type(self.scheduler)
Expand Down Expand Up @@ -851,7 +851,7 @@ def __init__(self, description="Select computer:", path_to_root="../", **kwargs)
self.observe(self.refresh, names="allow_select_disabled")

self._setup_another = ipw.HTML(
value=f"""<a href={path_to_root}aiidalab-widgets-base/setup_computer.ipynb target="_blank">
value=f"""<a href={path_to_root}aiidalab-widgets-base/notebooks/setup_computer.ipynb target="_blank">
Setup new computer</a>"""
)

Expand All @@ -869,7 +869,7 @@ def _get_computers(self):
user = User.objects.get_default()

return {
c[0].name: c[0]
c[0].label: c[0]
for c in QueryBuilder().append(Computer).all()
if c[0].is_user_configured(user)
and (self.allow_select_disabled or c[0].is_user_enabled(user))
Expand All @@ -890,7 +890,7 @@ def refresh(self, _=None):

@validate("selected_computer")
def _validate_selected_computer(self, change):
"""Select computer either by name or by class instance."""
"""Select computer either by label or by class instance."""
computer = change["value"]
self.output.value = ""
if not computer:
Expand All @@ -902,7 +902,7 @@ def _validate_selected_computer(self, change):
was found in your AiiDA database."""

if isinstance(computer, Computer):
if computer.name in self.computers:
if computer.label in self.computers:
return computer
self.output.value = f"""The computer instance '<span style="color:red">{computer}</span>'
supplied was not found in your AiiDA database."""
Expand Down
8 changes: 4 additions & 4 deletions aiidalab_widgets_base/elns.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, path_to_root="../", **kwargs):
eln = connect_to_eln(**kwargs)

if eln is None:
url = f"{path_to_root}aiidalab-widgets-base/eln_configure.ipynb"
url = f"{path_to_root}aiidalab-widgets-base/notebooks/eln_configure.ipynb"
error_message.value = f"""Warning! The access to ELN {kwargs['eln_instance']} is not configured. Please follow <a href="{url}" target="_blank">the link</a> to configure it."""
return

Expand Down Expand Up @@ -99,7 +99,7 @@ def __init__(self, path_to_root="../", **kwargs):
else:
self.modify_settings.disabled = True
send_button.disabled = True
self.message.value = f"""Warning! The access to an ELN is not configured. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/eln_configure.ipynb" target="_blank">the link</a> to configure it."""
self.message.value = f"""Warning! The access to an ELN is not configured. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/notebooks/eln_configure.ipynb" target="_blank">the link</a> to configure it."""

super().__init__(children=children, **kwargs)

Expand Down Expand Up @@ -137,15 +137,15 @@ def send_to_eln(self, _=None):
f"\u2705 The data were successfully sent to {self.eln.eln_instance}."
)
else:
self.message.value = f"""\u274C Something isn't right! We were not able to send the data to the "<strong>{self.eln.eln_instance}</strong>" ELN instance. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/eln_configure.ipynb" target="_blank">the link</a> to update the ELN's configuration."""
self.message.value = f"""\u274C Something isn't right! We were not able to send the data to the "<strong>{self.eln.eln_instance}</strong>" ELN instance. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/notebooks/eln_configure.ipynb" target="_blank">the link</a> to update the ELN's configuration."""

def handle_output(self, _=None):
with self._output:
clear_output()
if self.modify_settings.value:
display(
ipw.HTML(
f"""Currently used ELN is: "<strong>{self.eln.eln_instance}</strong>". To change it, please follow <a href="{self.path_to_root}/aiidalab-widgets-base/eln_configure.ipynb" target="_blank">the link</a>."""
f"""Currently used ELN is: "<strong>{self.eln.eln_instance}</strong>". To change it, please follow <a href="{self.path_to_root}/aiidalab-widgets-base/notebooks/eln_configure.ipynb" target="_blank">the link</a>."""
)
)
display(self.eln.sample_config_editor())
Expand Down
8 changes: 4 additions & 4 deletions aiidalab_widgets_base/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ def on_btn_submit_press(self, _=None):

if self.append_output:
self.submit_out.value += f"""Submitted process {self.process}. Click
<a href={self.path_to_root}aiidalab-widgets-base/process.ipynb?id={self.process.pk}
<a href={self.path_to_root}aiidalab-widgets-base/notebooks/process.ipynb?id={self.process.pk}
target="_blank">here</a> to follow.<br>"""
else:
self.submit_out.value = f"""Submitted process {self.process}. Click
<a href={self.path_to_root}aiidalab-widgets-base/process.ipynb?id={self.process.pk}
<a href={self.path_to_root}aiidalab-widgets-base/notebooks/process.ipynb?id={self.process.pk}
target="_blank">here</a> to follow."""

for func in self._run_after_submitted:
Expand Down Expand Up @@ -378,7 +378,7 @@ def calc_info(self, node):
raise TypeError("Unknown type: {}".format(type(node)))

process_state = node.process_state.value.capitalize()
pk = """<a#space#href={0}aiidalab-widgets-base/process.ipynb?id={1}#space#target="_blank">{1}</a>""".format(
pk = """<a#space#href={0}aiidalab-widgets-base/notebooks/process.ipynb?id={1}#space#target="_blank">{1}</a>""".format(
self.path_to_root, node.pk
)

Expand Down Expand Up @@ -659,7 +659,7 @@ def update(self, _=None):

# Add HTML links.
dataf["PK"] = dataf["PK"].apply(
lambda x: """<a href={0}aiidalab-widgets-base/process.ipynb?id={1} target="_blank">{1}</a>""".format(
lambda x: """<a href={0}aiidalab-widgets-base/notebooks/process.ipynb?id={1} target="_blank">{1}</a>""".format(
self.path_to_root, x
)
)
Expand Down
1 change: 1 addition & 0 deletions docs/source/widget-list/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
notebooks
1 change: 0 additions & 1 deletion docs/source/widget-list/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ See also the `corresponding git repository <https://github.com/aiidalab/aiidalab
notebooks/process
notebooks/process_list
notebooks/structures
notebooks/structures_multi
notebooks/wizard_apps
notebooks/eln_configure
notebooks/eln_import
1 change: 1 addition & 0 deletions eln_import.ipynb
47 changes: 0 additions & 47 deletions notebooks/structures_multi.ipynb

This file was deleted.

7 changes: 0 additions & 7 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,15 @@
TEMPLATE = """
<table>
<tr>
<th style="text-align:center">Basic data objects.</th>
<th style="width:70px" rowspan=2></th>
<th style="text-align:center">Codes and computers.</th>
<th style="width:70px" rowspan=2></th>
<th style="text-align:center">Processes.</th>
<th style="width:70px" rowspan=2></th>
<th style="text-align:center">Electronic Lab Notebook.</th>
<tr>
<td valign="top"><ul>
<li><a href="{appbase}/notebooks/structures.ipynb" target="_blank">Dealing with one structure</a></li>
<li><a href="{appbase}/notebooks/aiida_datatypes_viewers.ipynb" target="_blank">AiiDA datatypes viewers</a></li>
</ul></td>
<td valign="top"><ul>
<li><a href="{appbase}/notebooks/setup_computer.ipynb" target="_blank">Setup computer</a></li>
<li><a href="{appbase}/notebooks/setup_code.ipynb" target="_blank">Setup code</a></li>
<li><a href="{appbase}/notebooks/codes_computers.ipynb" target="_blank">Dealing with codes and computers</a></li>
</ul></td>
<td valign="top"><ul>
<li><a href="{appbase}/notebooks/process_list.ipynb" target="_blank">Process list</a></li>
Expand Down

0 comments on commit 3c509a5

Please sign in to comment.