3D-Beacons / 3d-beacons-client

Implementation of the 3D-Beacons client (local 3D model server)
Apache License 2.0
3 stars 6 forks source link

Reserved characters error running snakemake #28

Closed sbliven closed 2 years ago

sbliven commented 2 years ago

I am following the README and have reached the snakemake step. I get an error:

$docker-compose exec cli snakemake --cores=2
Searching for models in data/cif ...
  ... found 1 model ids
Building DAG of jobs...
Using shell: /bin/bash
Provided cores: 2
Rules claiming more threads will be scaled down.
Job stats:
job          count    min threads    max threads
---------  -------  -------------  -------------
all              1              1              1
loadindex        1              1              1
total            2              1              1

Select jobs to execute...

[Wed Jan 19 11:16:01 2022]
rule loadindex:
    input: data/index/P38398_1jm7.1.A_1_103.json
    output: data/index/P38398_1jm7.1.A_1_103.json.loaded
    jobid: 1
    wildcards: model=P38398_1jm7.1.A_1_103
    resources: tmpdir=/tmp

Traceback (most recent call last):
  File "/usr/local/bin/3dbeacons-cli", line 33, in <module>
    sys.exit(load_entry_point('bio3dbeacons', 'console_scripts', '3dbeacons-cli')())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/app/bio3dbeacons/cli/cli.py", line 118, in load_mongo
    mongoload.run(index_path, mongo_db_url, batch_size)
  File "/app/bio3dbeacons/cli/mongoload/mongoload.py", line 48, in run
    lm.init_collection(mongo_db_url)
  File "/app/bio3dbeacons/cli/mongoload/mongoload.py", line 27, in init_collection
    mongo_db_url).models.modelCollection
  File "/usr/local/lib/python3.7/site-packages/pymongo/mongo_client.py", line 681, in __init__
    srv_max_hosts=srv_max_hosts)
  File "/usr/local/lib/python3.7/site-packages/pymongo/uri_parser.py", line 558, in parse_uri
    nodes = split_hosts(hosts, default_port=default_port)
  File "/usr/local/lib/python3.7/site-packages/pymongo/uri_parser.py", line 365, in split_hosts
    nodes.append(parse_host(entity, port))
  File "/usr/local/lib/python3.7/site-packages/pymongo/uri_parser.py", line 121, in parse_host
    raise ValueError("Reserved characters such as ':' must be "
ValueError: Reserved characters such as ':' must be escaped according RFC 2396. An IPv6 address literal must be enclosed in '[' and ']' according to RFC 2732.
[Wed Jan 19 11:16:01 2022]
Error in rule loadindex:
    jobid: 1
    output: data/index/P38398_1jm7.1.A_1_103.json.loaded
    shell:
        3dbeacons-cli load-index -i data/index/P38398_1jm7.1.A_1_103.json && touch data/index/P38398_1jm7.1.A_1_103.json.loaded
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message

I'm using docker desktop 3.5.1 on macOS.

sbliven commented 2 years ago

@sillitoe suggested it might be a hostname problem. My hostname does look vaguely like an ip6 address without the colons:

$ docker-compose exec cli hostname
f0fe89e0d800

I'll look into whether I can set this in the compose file

iandaaci commented 2 years ago

Thanks. Yup, looks like the error is coming from pymongo trying to parse the hostname. Might be possible to set env in the compose file (seems a bit hacky, but might be the least hacky workaround)

sbliven commented 2 years ago

My randomly generated MONGO_PASSWORD had both a : and a / in it. These get put directly into the url. Solution should be URL-encoding the password.