Skip to content

Conversation

@aroundabout
Copy link
Contributor

@aroundabout aroundabout commented Nov 6, 2023

Purpose of the PR

  • support docker for hugegraph-loader

Main Changes

  1. Dockerfile for loader
  2. an example docker-compose for loader

usage

(add the usage to README and doc later)

current test image is dandelionivy/loader

cd hugegraph-loader/docker/example/ docker-compose up -d docker exec -it loader bash
sh bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -h graph -p 8080

It should be like:

user@LAPTOP-MRGBSP9S:~/incubator-hugegraph-toolchain/hugegraph-loader/docker/example$ sudo docker-compose up -d Creating graph ... done Creating loader ... done Creating hubble ... done user@LAPTOP-MRGBSP9S:~/incubator-hugegraph-toolchain/hugegraph-loader/docker/example$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 59f431e622d0 hugegraph/hubble "./bin/start-hubble.…" About a minute ago Up About a minute 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp hubble 55360d18f7d7 dandelionivy/loader "/usr/bin/dumb-init …" About a minute ago Up About a minute loader 35b3feefc8bf hugegraph/hugegraph "/usr/bin/dumb-init …" About a minute ago Up About a minute 0.0.0.0:18081->8080/tcp, :::18081->8080/tcp graph user@LAPTOP-MRGBSP9S:~/incubator-hugegraph-toolchain/hugegraph-loader/docker/example$ sudo docker exec -it loader bash root@55360d18f7d7:/loader# sh bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -h graph -p 8080 ... vertices/edges loaded this time : 8/6 -------------------------------------------------- count metrics input read success : 14 input read failure : 0 vertex parse success : 8 vertex parse failure : 0 vertex insert success : 8 vertex insert failure : 0 edge parse success : 6 edge parse failure : 0 edge insert success : 6 edge insert failure : 0 -------------------------------------------------- meter metrics total time : 0.199s read time : 0.046s load time : 0.153s vertex load time : 0.077s vertex load rate(vertices/s) : 103 edge load time : 0.112s edge load rate(edges/s) : 53 root@55360d18f7d7:/loader# 

Then we can see the result in hubble:

image

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:

Does this PR potentially affect the following parts?

  • Nope
  • Dependencies (add/update license info)
  • Modify configurations
  • The public API
  • Other affects (typed here)

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need
@github-actions github-actions bot added the loader hugegraph-loader label Nov 6, 2023
@codecov
Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #530 (56ac508) into master (71e623d) will decrease coverage by 0.03%.
Report is 1 commits behind head on master.
The diff coverage is n/a.

@@ Coverage Diff @@ ## master #530 +/- ## ============================================ - Coverage 62.49% 62.47% -0.03%  + Complexity 1903 930 -973  ============================================ Files 262 93 -169 Lines 9541 4509 -5032 Branches 886 529 -357 ============================================ - Hits 5963 2817 -3146  + Misses 3190 1483 -1707  + Partials 388 209 -179 

see 169 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

WORKDIR /pkg

RUN set -x \
&& mvn install -pl hugegraph-client,hugegraph-loader -am -Dmaven.javadoc.skip=true -DskipTests -ntp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that in the center maven repo, the client-1.0.0 does not have some methods like istext(). Hence, we should install the jar locally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that in the center maven repo, the client-1.0.0 does not have some methods like istext(). Hence, we should install the jar locally.

seems we don't rely on fixed version? we use $revision in the project, so install client first is necessary (if we want build the latest image)

@github-actions github-actions bot added the hubble hugegraph-hubble label Nov 6, 2023
@imbajin
Copy link
Member

imbajin commented Nov 7, 2023

@liuxiaocs7 could also check the PR when free

WORKDIR /pkg

RUN set -x \
&& mvn install -pl hugegraph-client,hugegraph-loader -am -Dmaven.javadoc.skip=true -DskipTests -ntp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that in the center maven repo, the client-1.0.0 does not have some methods like istext(). Hence, we should install the jar locally.

seems we don't rely on fixed version? we use $revision in the project, so install client first is necessary (if we want build the latest image)

Comment on lines 50 to 51
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD [ "/bin/bash" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe check other usage way for dumb-init ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there is no special usage. We only need to add dumb-init in entrypoint. Maybe tail -f /dev/null is better than /bin/bash.

## Building
## 2. Usage for Docker(Recommand)

- deploy `loader` with Docker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- deploy `loader` with Docker
- run `loader` with Docker
#### 2.2.1 enter the docker container

```bash
docker exec -it loader bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember update here when doc update apache/incubator-hugegraph-doc#299 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider also add a new section (run with docker) in root (README) https://github.com/apache/incubator-hugegraph-toolchain/blob/master/README.md#modules

and keep the module section clear
image

@liuxiaocs7
Copy link
Member

liuxiaocs7 commented Nov 10, 2023

Hi, @aroundabout, thanks for your outstanding efforts on this issue, i test locally and find some issues and hope your help.

Firstly, i try to build the image locally but fails.

(base) kirin@kirinbiotech:~/lx/incubator-hugegraph-toolchain$ docker build -t hg-loader:1.0 hugegraph-loader/

image

Then, i use loader image from here: https://hub.docker.com/r/dandelionivy/loader/tags where server and hubble deployed separately.

image

kirin@kirinbiotech:~/lx/incubator-hugegraph-toolchain/hugegraph-loader/assembly/static$ docker exec -it loader bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -p 8080 -h 192.168.110.158

image

but still fails to load data.

CC: @imbajin

@aroundabout
Copy link
Contributor Author

aroundabout commented Nov 10, 2023

Hi, @aroundabout, thanks for your outstanding efforts on this issue, i test locally and find some issues.

Firstly, i try to build the image locally but fails.

(base) kirin@kirinbiotech:~/lx/incubator-hugegraph-toolchain$ docker build -t hg-loader:1.0 hugegraph-loader/ 

image

Then, i use loader image from here: https://hub.docker.com/r/dandelionivy/loader/tags

image

kirin@kirinbiotech:~/lx/incubator-hugegraph-toolchain/hugegraph-loader/assembly/static$ docker exec -it loader bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -p 8080 -h 192.168.110.158 

image

but still fails to load data.

  1. How to build locally
    try docker build -f hugegraph-loader/Dockerfile hg-loader .
    Because loader depends on client and the client-1.0.0 in maven repo does not have some methods like 'istext()', so we should build client locally in dockerfile. Hence, the docker build context should be root path
  2. The question is caused by server [Bug] Unexpected stream error with gzip & need enhance filter logic incubator-hugegraph#2346. The PR to fix it has been opened fix(api): refactor/downgrade record logic for slow log incubator-hugegraph#2347
@liuxiaocs7
Copy link
Member

How to build locally
try docker build -f hugegraph-loader/Dockerfile hg-loader .
Because loader depends on client and the client-1.0.0 in maven repo does not have some methods like 'istext()', so we should build client locally in dockerfile. Hence, the docker build context should be root path

Thanks for your details explain, i see.

docker build -f hugegraph-loader/Dockerfile hg-loader . 

seems fails too? And does it need to be added to the readme?

image

@aroundabout
Copy link
Contributor Author

How to build locally
try docker build -f hugegraph-loader/Dockerfile hg-loader .
Because loader depends on client and the client-1.0.0 in maven repo does not have some methods like 'istext()', so we should build client locally in dockerfile. Hence, the docker build context should be root path

Thanks for your details explain, i see.

docker build -f hugegraph-loader/Dockerfile hg-loader . 

seems fails too? And does it need to be added to the readme?

image

Sorry, I forgot an argument. XD

docker build -f hugegraph-loader/Dockerfile -t hg-loader .

It can works now.
image

@liuxiaocs7
Copy link
Member

How to build locally
try docker build -f hugegraph-loader/Dockerfile hg-loader .
Because loader depends on client and the client-1.0.0 in maven repo does not have some methods like 'istext()', so we should build client locally in dockerfile. Hence, the docker build context should be root path

Thanks for your details explain, i see.

docker build -f hugegraph-loader/Dockerfile hg-loader . 

seems fails too? And does it need to be added to the readme?
image

Sorry, I forgot an argument. XD

docker build -f hugegraph-loader/Dockerfile -t hg-loader .

It can works now. image

image

works!

Copy link
Member

@liuxiaocs7 liuxiaocs7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~

Copy link
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THX

@simon824 simon824 merged commit e8fcdd3 into apache:master Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hubble hugegraph-hubble loader hugegraph-loader

4 participants