Skip to content

Commit

Permalink
working version of dummy aiidalab
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sintef committed Dec 7, 2022
1 parent 95c8c0d commit f6b472b
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt-get update && apt-get install -y git openssh-client && rm -rf /var/lib/a
# Download and install AiiDA plugin for MarketPlace UC3
RUN git config --global user.name "MarketPlace" && git config --global user.email "[email protected]"
RUN mkdir -p /marketplace
RUN --mount=type=secret,id=mp_gitlab_token git clone "https://token:$(cat /run/secrets/mp_gitlab_token)@gitlab.cc-asp.fraunhofer.de/Daniel.Marchand/aiida-marketusercase3.git" /marketplace/aiida-marketusercase3
RUN git clone [email protected]:daniel-sintef/aiida-marketusercase3.git /marketplace/aiida-marketusercase3
RUN pip install -e /marketplace/aiida-marketusercase3 && reentry scan

# Copy in UC3 App
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile_SSH
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ FROM aiidalab/aiidalab-docker-stack:latest
RUN apt-get update && apt-get install -y git openssh-client && rm -rf /var/lib/apt/lists/*

# Download and install AiiDA plugin for MarketPlace UC3
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.cc-asp.fraunhofer.de >> ~/.ssh/known_hosts
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN git config --global user.name "MarketPlace" && git config --global user.email "[email protected]"
RUN mkdir -p /marketplace
RUN --mount=type=ssh git clone git@gitlab.cc-asp.fraunhofer.de:Daniel.Marchand/aiida-marketusercase3.git /marketplace/aiida-marketusercase3
RUN --mount=type=ssh git clone 'git@github.com:daniel-sintef/aiida-marketusercase3.git' /marketplace/aiida-marketusercase3
RUN pip install -e /marketplace/aiida-marketusercase3 && reentry scan

# Copy in UC3 App
Expand Down
17 changes: 17 additions & 0 deletions setup_droplet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if [ -f "/home/aiida/.ssh/config" ]; then
cat /home/aiida/apps/aiidalab-mp-uc3/sshfiles/config >> /home/aiida/.ssh/config
else
cp /home/aiida/apps/aiidalab-mp-uc3/sshfiles/config /home/aiida/.ssh/
fi

# I'm certain smarter use of options would mean we can bypass copying the known_hosts
# AiiDA's AutoAdd policy *should* handle this, but doesn't...
if [ -f "/home/aiida/.ssh/known_hosts" ]; then
cat /home/aiida/apps/aiidalab-mp-uc3/sshfiles/known_hosts >> /home/aiida/.ssh/known_hosts
else
cp /home/aiida/apps/aiidalab-mp-uc3/sshfiles/known_hosts /home/aiida/.ssh/
fi

verdi computer setup --config /home/aiida/apps/aiidalab-mp-uc3/setup_files/droplet/computer_setup.yml
verdi computer configure ssh --config /home/aiida/apps/aiidalab-mp-uc3/setup_files/droplet/computer_configure.yml droplet
verdi code setup --config /home/aiida/apps/aiidalab-mp-uc3/setup_files/droplet/code_setup.yml
8 changes: 8 additions & 0 deletions setup_files/droplet/code_setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
label: "FSP-dummy"
description: "Dummy Flame spray code "
input_plugin: "dummy_marketuc3"
on_computer: true
remote_abs_path: "/home/aiida/bin/wait_watch.sh"
computer: "droplet"
prepend_text: ""
append_text: ""
17 changes: 17 additions & 0 deletions setup_files/droplet/computer_configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
username: "root"
port: 22
look_for_keys: True
key_filename: "/home/aiida/.ssh/aiidalabkey"
timeout: 60
allow_agent: True
proxy_jump: ""
proxy_command: ""
compress: True
gss_auth: False
gss_kex: False
gss_deleg_creds: False
gss_host: ""
load_system_host_keys: True
key_policy: "AutoAddPolicy"
use_login_shell: True
safe_interval: 30.0
11 changes: 11 additions & 0 deletions setup_files/droplet/computer_setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
label: droplet
hostname: 161.35.206.72
description: "droplet instance"
transport: "ssh"
scheduler: "direct"
shebang: "#!/bin/bash"
work_dir: "/home/aiida"
mpirun_command: "run -np {tot_num_mpiprocs}"
mpiprocs_per_machine: 1
prepend_text: " "
append_text: " "
5 changes: 5 additions & 0 deletions sshfiles/config
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ Host jumpunity
Host stepstone.sintef.no
StrictHostKeyChecking no
IdentityFile /home/aiida/.ssh/stepstone

Host droplet
Hostname 161.35.206.72
User root
IdentityFile /home/aiida/.ssh/aiidalabkey
4 changes: 2 additions & 2 deletions uc3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.13 ('mp_uc3')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -144,7 +144,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.8.10"
},
"vscode": {
"interpreter": {
Expand Down
2 changes: 1 addition & 1 deletion uc3/base_widgets_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def update(self, _=None) -> None:
f"{code_setup['label']}-{computer_path.name}": code_setup,
}
app_database["default"] = computer_path.name
app_database = {"marketusercase3": app_database}
app_database = {"dummy_marketuc3": app_database}

database = deepcopy(aiida_code_registry_database)
database.update(app_database)
Expand Down
12 changes: 7 additions & 5 deletions uc3/steps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""The AiiDAlab App steps."""
import json
import uuid
import logging
import subprocess
from copy import copy
Expand All @@ -9,7 +10,7 @@
import shortuuid
import traitlets
from aiida.engine import ProcessState, submit
from aiida.orm import ArrayData, Code, Dict, ProcessNode, load_code
from aiida.orm import ArrayData, Code, Dict, Str, ProcessNode, load_code
from aiida.plugins import CalculationFactory
from aiidalab_widgets_base import (
AiidaNodeViewWidget,
Expand Down Expand Up @@ -45,7 +46,7 @@ def __init__(self, **kwargs):
self._logger = kwargs.pop("logger", logging.getLogger("aiidalab_mp_uc3"))

text_description = ipw.HTML(
value=" Key must be called stepstone. \n Skip Manually to the next step if you have already uploaded a key",
value=" Key must be called aiidalabkey. \n Skip Manually to the next step if you have already uploaded a key",
)

children = [text_description, self._inp_private_key, self._upload_button]
Expand Down Expand Up @@ -138,7 +139,7 @@ def _install_codecomputer(self, _=None):
self.message = "Installing Computer"
keygen_cmd = [
"sh",
"/home/aiida/apps/aiidalab-mp-uc3/setup_unity.sh",
"/home/aiida/apps/aiidalab-mp-uc3/setup_droplet.sh",
"&&",
"reentry",
"scan",
Expand Down Expand Up @@ -172,7 +173,7 @@ def __init__(self, **kwargs) -> None:
)
# create code selection field
self.computer_code_selector = ComputationalResourcesWidget(
input_plugin="marketusercase3"
input_plugin="dummy_marketuc3"
)
self.computer_code_selector.observe(self._set_code_value, ["value"])

Expand Down Expand Up @@ -349,10 +350,11 @@ def _observe_configuration(self, change):
)

def submit_calc(self, button):
fluent_calcjob = CalculationFactory("marketusercase3")
fluent_calcjob = CalculationFactory("dummy_marketuc3")
fluentcalc_builder = fluent_calcjob.get_builder()
fluentcalc_builder.user_inputs = Dict(dict=self.user_inputs)
fluentcalc_builder.code = self.mpuc3_code
fluentcalc_builder.job_uuid = Str(str(uuid.uuid4()))

# Not sure how to get around hard coding this...
fluentcalc_builder.metadata.options.resources = {
Expand Down

0 comments on commit f6b472b

Please sign in to comment.