Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
avatar-lavventura committed Apr 13, 2023
2 parents 70ac957 + 7a2e26e commit 0896208
Show file tree
Hide file tree
Showing 184 changed files with 5,042 additions and 2,451 deletions.
68 changes: 68 additions & 0 deletions .depreciated/imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env python3

from web3 import IPCProvider, Web3
from web3.middleware import geth_poa_middleware
from web3.providers.rpc import HTTPProvider

from broker.utils import is_geth_on, run, terminate


def _connect_to_web3() -> None:
"""Connect to web3 of the corresponding ethereum blockchain.
* bloxberg:
__ https://bloxberg.org
"""
if env.IS_GETH_TUNNEL or not env.IS_EBLOCPOA:
if env.IS_BLOXBERG:
# TODO you can use brownie's connected web3?
cfg.w3 = Web3(HTTPProvider("https://core.bloxberg.org"))
else:
cfg.w3 = Web3(HTTPProvider(f"http://localhost:{env.RPC_PORT}"))
else:
cfg.w3 = Web3(IPCProvider(env.DATADIR.joinpath("geth.ipc")))
#: inject the poa compatibility middleware to the innermost layer
cfg.w3.middleware_onion.inject(geth_poa_middleware, layer=0)


def connect_to_web3() -> None:
"""Connect to the private ethereum network using web3.
Note that you should create only one RPC Provider per process, as it
recycles underlying TCP/IP network connections between your process and
Ethereum node
"""
if cfg.w3.isConnected():
return

web3_ipc_fn = env.DATADIR.joinpath("geth.ipc")
for _ in range(5):
_connect_to_web3()
if not cfg.w3.isConnected():
try:
if env.IS_GETH_TUNNEL:
raise Exception("Web3ConnectError: try tunnelling: ssh -f -N -L 8545:localhost:8545 username@<ip>")

if env.IS_BLOXBERG:
log("E: web3 is not connected into [green]BLOXBERG[/green]")
else:
is_geth_on()
except QuietExit:
pass
except Exception as e:
print_tb(e)
sys.exit(1)

if not env.IS_GETH_TUNNEL and not env.IS_BLOXBERG:
log(
"E: If web3 is not connected please start geth server and give permission \n"
"to /private/geth.ipc file doing: ",
end="",
)
log(f"sudo chown $(logname) {web3_ipc_fn}", "green")
log(f"#> running `sudo chown $(whoami) {web3_ipc_fn}`")
run(["sudo", "chown", env.WHOAMI, web3_ipc_fn])
else:
break
else:
terminate(is_traceback=False)
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,5 @@ README.html
_slurm/example/hello
alper.csv
helloWorld.txt
volumes
volumes
provider_*.txt
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "orcid-authentication"]
path = orcid-authentication
url = https://github.com/avatar-lavventura/orcid-authentication
url = https://github.com/avatar-lavventura/orcid-authentication
[submodule "bloxbergBootnodeSetup"]
path = bloxbergBootnodeSetup
url = https://github.com/avatar-lavventura/bloxbergBootnodeSetup
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ repos:
entry: bash -c 'mypy "$@" || true' --

- repo: https://github.com/psf/black
rev: 22.3.0 # Replace by any tag/version: https://github.com/psf/black/tags
rev: 23.3.0 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
name: black
exclude: ^.old_work/
exclude: ^.depreciated/

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
exclude: ".depreciated/.*|.old_work/.*"

default_language_version:
python: python3
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# syntax=docker/dockerfile:1
FROM golang:latest
RUN apt-get install -y ca-certificates
RUN wget --no-check-certificate -q "https://dist.ipfs.io/go-ipfs/v0.13.0/go-ipfs_v0.13.0_linux-amd64.tar.gz" \
&& tar -xf "go-ipfs_v0.13.0_linux-amd64.tar.gz" \
&& rm -f go-ipfs_v0.13.0_linux-amd64.tar.gz \
ARG IPFS_TAG=v0.19.0
RUN wget --no-check-certificate -q "https://dist.ipfs.io/go-ipfs/"${IPFS_TAG}"/go-ipfs_"${IPFS_TAG}"_linux-amd64.tar.gz" \
&& tar -xf "go-ipfs_"${IPFS_TAG}"_linux-amd64.tar.gz" \
&& rm -f go-ipfs_${IPFS_TAG}_linux-amd64.tar.gz \
&& cd go-ipfs \
&& make install \
&& ./install.sh
Expand Down Expand Up @@ -34,7 +35,7 @@ ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini

# Install mongodb
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | tee /etc/apt/trusted.gpg.d/mongodb.asc > /dev/null \
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc | tee /etc/apt/trusted.gpg.d/mongodb.asc > /dev/null \
&& echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list \
&& apt-get update \
&& apt-get install -y mongodb-org \
Expand Down Expand Up @@ -63,7 +64,8 @@ RUN apt-get update \
nodejs \
python3-venv \
sudo \
netcat \
davfs2 \
netcat-traditional \
supervisor \
nano \
less \
Expand All @@ -88,6 +90,7 @@ ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /workspace
RUN git clone https://github.com/ebloc/ebloc-broker.git
WORKDIR /workspace/ebloc-broker

#: `pip install -e .` takes few minutes
RUN git checkout dev >/dev/null 2>&1 \
&& git fetch --all --quiet >/dev/null 2>&1 \
Expand Down
30 changes: 20 additions & 10 deletions README.org
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
* ebloc-broker

*eBlocBroker is a smart contract that applies blockchain technology to provide a market for
computational and data resources to research communities.*
=eBlocBroker= is a smart contract as an autonomous volunteer computing and sharing data resource broker based on blockchain for e-Science.
It applies blockchain technology to provide a market for computational and data resources to research communities.

# For more info see: ...

Expand All @@ -12,10 +12,10 @@ computational and data resources to research communities.*

- [[https://github.com/SchedMD/slurm][Slurm]],
[[https://ipfs.io][IPFS]],
[[https://github.com/eth-brownie/brownie][eth-brownie]],
[[https://github.com/prasmussen/gdrive][prasmussen/gdrive]],
[[https://github.com/owncloud/pyocclient][owncloud/pyocclient]],
[[https://github.com/eth-brownie/brownie][eth-brownie]],
[[https://github.com/trufflesuite/ganache][ganache-cli]]
[[https://github.com/trufflesuite/ganache][ganache-cli]].
# [[https://geth.ethereum.org/docs/getting-started][Geth]]

** Using Docker
Expand Down Expand Up @@ -43,8 +43,7 @@ docker-compose down

** Cloud Storages

*** EUDAT

*** B2DROP
**** Create B2ACCESS user account and login into B2DROP:

First, from [[https://b2access.eudat.eu/home/][B2ACCESS home page]]
Expand Down Expand Up @@ -76,7 +75,9 @@ In order to submit your job each user should already registered into eBlocBroker
# Please update following arguments inside ~register.yaml~.
After registration is done, each user should authenticate their ORCID iD using the following [[http://eblocbroker.duckdns.org/]].

~$ eblocbroker submit job.yaml~
#+begin_src bash
$ eblocbroker submit job.yaml
#+end_src

**** Example yaml file in order to define a job to submit.

Expand Down Expand Up @@ -112,18 +113,27 @@ config:

- ~path~ should represented as full path of the corresponding folder.
- ~cache_type~ should be variable from [ ~public~, ~private~ ]
- ~storaage_id~ should be variable from [ ~ipfs~, ~ipfs_gpg~, ~none~, ~eudat~, ~gdrive~ ]
- ~storage_id~ should be variable from [ ~ipfs~, ~ipfs_gpg~, ~none~, ~b2drop~, ~gdrive~ ]

-----------------------------------

** Provider

Each provider should run ~eblocbroker driver~ for start running the Python script.

*** Screenshot of provider GUI:

#+HTML: <details><summary>Example screenshot of provider GUI:</summary>

[[file:/docs/gui1.png]]

#+HTML: </details>


** 🎬 Demonstration

- [[https://asciinema.org/a/551809]]
- [[https://asciinema.org/a/551843]]


** Acknowledgement

This work is supported by the Turkish Directorate of Strategy and Budget under the TAM Project
Expand Down
1 change: 1 addition & 0 deletions bloxbergBootnodeSetup
Submodule bloxbergBootnodeSetup added at 892a9c
72 changes: 0 additions & 72 deletions broker/.TODO.org_archive

This file was deleted.

Loading

0 comments on commit 0896208

Please sign in to comment.