You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a new task from s3 files listed in our cvat bucket. This is using cvat-sdk==2.8.1 .
def get_client(username, password, cvat_host):
dbutils = DBUtils()
config = Configuration(
host=cvat_host,
username=username,
password=password
)
api_client = ApiClient(config)
login_serializer_ex_request = models.LoginSerializerExRequest(
username=username,
email=f'{username}@procore.com',
password=password,
)
auth_key, resp = api_client.auth_api.create_login(login_serializer_ex_request)
assert "sessionid" in api_client.cookies
api_client.set_default_header("Authorization", "Token " + auth_key['key'])
return api_client
def create_task_from_s3(
project_id: int,
file_id: str,
filenames: list[str],
subset: str = "train",
):
"""Creates a task in CVAT using an S3 bucket as the
Connected File share it assumes the file share
is already configured
Note: make sure image names are sorted
lexicographically as cvat will do
this by default, and your tags
might now be aligned if the paths
are not sorted
"""
task_spec = {
"project_id": project_id,
"name": str(file_id),
}
task = None
try:
# import pdb; pdb.set_trace()
module = client.tasks # <-------- error occurs here:
task = client.tasks.create_from_data(
spec=task_spec,
data_params={"image_quality": 95},
resource_type=ResourceType.SHARE,
resources=filenames,
)
except Exception as e:
print(f"Exception creating task {prostore_file_id}: {e}")
return task
I did a pdb session and found that there is a bug in the client api:
def __getattr__(self, key):
779 notfound = object()
--> 780 api_instance, api_klassname = self._apis.get(key, notfound)
781 if api_instance is notfound:
782 raise AttributeError(f"Can't find the '{key}' attribute")
in this case the keys are all 'X_api', e.g., 'tasks_api' and not 'tasks'. Since 'tasks' is not found, not found is returned, but not found is a singleton, not a tuple.
Expected Behavior
return the correct api (tasks_api) when using client.tasks
Possible Solution
No response
Context
No response
Environment
No response
The text was updated successfully, but these errors were encountered:
Hi, how the client object is created? It's not clear from the code snippet provided. I can see module = client.tasks, but tasks should not be a module. An example of using high-level Client objects can be found here.
Actions before raising this issue
Steps to Reproduce
I am trying to create a new task from s3 files listed in our cvat bucket. This is using
cvat-sdk==2.8.1
.I did a pdb session and found that there is a bug in the client api:
in this case the keys are all 'X_api', e.g., 'tasks_api' and not 'tasks'. Since 'tasks' is not found, not found is returned, but not found is a singleton, not a tuple.
Expected Behavior
return the correct api (tasks_api) when using client.tasks
Possible Solution
No response
Context
No response
Environment
No response
The text was updated successfully, but these errors were encountered: