Hi ,all I have a problem when use the python lakef...
# help
y
Hi ,all I have a problem when use the python lakefs_client: I have deployed the lakefs service locally. when i use the example api: client.repositories_api.list_repositories(prefix="",after="", amount=100 ) .It reported an error: urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='xxx', port=xxx): Max retries exceeded with url: /api/v1/repositories (Caused by ProtocolError('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))) However , other api :such as :client.repositories_api.delete_repository(repo_name),,client.branches_api.create_branch(repository=repo_name, branch_creation=branch_creation) are ok. list_repositories and list_branches api are have the error
👍 1
g
Hi @yiming song, I wasn’t able to reproduce on my side. Can you please provide the versions of lakeFS server and python client? Adding the commands for convenience •
lakefs --version
pip show lakefs_client
u
Hi, im the one ,thank u for help. the versions of Lakefs is 0.105.0, the lakefs_client is 0.105.0
👀 2
g
I wasn’t able to reproduce: Can you please try to run the following code:
Copy code
import lakefs_client
from lakefs_client.client import LakeFSClient

configuration = lakefs_client.Configuration()
configuration.username = 'AKIAIOSFDNN7EXAMPLEQ'
configuration.password = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
configuration.host = '<http://localhost:8000>'
client = LakeFSClient(configuration)
resp = client.repositories_api.list_repositories(prefix="",after="", amount=100)
for item in resp.results:
    print(item)
Change the configuration to fit to your environment
Also, is there any load-balancer/proxy between your client to lakeFS?
u
it still reported it wrong. and there is no load-balancer/proxy between my client to lakeFS.
my lakefs server was run with docker ; docker run -p 8001:8000 -e LAKEFS_BLOCKSTORE_TYPE='s3' \ -e LAKEFS_BLOCKSTORE_S3_FORCE_PATH_STYLE='true' \ -e LAKEFS_BLOCKSTORE_S3_ENDPOINT='http://xx.xx.xx.xx:9000' \ -e LAKEFS_BLOCKSTORE_S3_DISCOVER_BUCKET_REGION='false' \ -e LAKEFS_BLOCKSTORE_S3_CREDENTIALS_ACCESS_KEY_ID='minioadmin' \ -e LAKEFS_BLOCKSTORE_S3_CREDENTIALS_SECRET_ACCESS_KEY='minioadmin' \ treeverse/lakefs run --local-settings
If I don't use the lakefs_client, I can call the api of the lakefs service I installed directly from postman and respond correctly
g
Where are you running the code, can you run it locally from your CLI?
u
yes I run it locally . in the pycharm
g
In the error message I see
Get /datasetmanage/lakefs/…
Where does that come from?
u
our team want to develop a dataset platform based on lakefs . So that Url is my.And I use the lakefs api during my own interface
g
Nice 😃, In order to try and identify the problem, can you please start by just running the provided command directly?
u
Okok.But I'm at home now, my computer is in my company. By the way , can I ask that what's the meaning of running the provided command .I'm sorry that my English is not good。🤣
g
Sorry I wasn’t clear, meant the code snippet I provided earlier
Copy code
import lakefs_client
from lakefs_client.client import LakeFSClient

configuration = lakefs_client.Configuration()
configuration.username = 'AKIAIOSFDNN7EXAMPLEQ'
configuration.password = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
configuration.host = '<http://localhost:8000>'
client = LakeFSClient(configuration)
resp = client.repositories_api.list_repositories(prefix="",after="", amount=100)
for item in resp.results:
    print(item)
Change the configuration to fit to your environment
u
Thank u for explaining. I will try it tomorrow. Thanks~
👍 1
Hi, i tried the code. And the results of the code are here . The first picture is to create the repository, and its result is correct. But the secend which is to list the repositories has error.
I deployed another lakefs service on another server, the same code, this time no errors. But the previous server, using postman to tune the same interface, can also respond normally ah, I am very puzzled
b
Can't see the host value - can you verify you don't specify any path there. like in the example code. Alternatively can you paste here the configuration.host value and instead of image mask replace any letter with x and any digit with 8?
u
import lakefs_client from lakefs_client.client import LakeFSClient from lakefs_client import models configuration = lakefs_client.Configuration() configuration.username = 'AKIAJLQJ6LOX57YS54VQ' configuration.password = 'XT2z7RRDX9QFr4Y4TrRQe1Qw9GAi4HgjH1XT7g5v' configuration.host = 'http://124.221.75.166:8001/' client = LakeFSClient(configuration) resp = client.repositories_api.list_repositories(prefix="", after="", amount=100) for item in resp.results: print(item)
and the minio is also on the server 124.221.75.1669000
b
Copy code
configuration.debug = True
should dump the raw request - it may help understanding why we are getting bad protocol error
u
thank u