Hello,
When it comes to setting the `max-workers` for an SDK, you have a couple of options:
Global Configuration: You can set global configurations that will apply to any instance of `CogniteClient` that is created after the global configurations have been set. Here's how you can set the `GlobalConfig`:
from cognite.client import global_config, ClientConfig
from cognite.client.credentials import Token
global_config.default_client_config = ClientConfig(
client_name="my-client", project="myproj", credentials=Token("verysecret")
)
global_config.max_workers = <desired_value>
Remember, any configurations set in the `global_config` should be made prior to instantiating a `CogniteClient` to ensure they take effect.
Directly in the CogniteClient Constructor: The documentation suggests that you can also pass a `ClientConfig` directly when you create a new `CogniteClient`. So, if you only want to set the `max_workers` for a specific instance, you can do so as:
config = ClientConfig(max_workers=<desired_value>, ...<other_params>)
client = CogniteClient(config)
To address your other questions:
- If you do not set the `GlobalConfig`, then yes, the SDK would utilize the default values for workers, retries, and other parameters.
- As for passing the `GlobalConfig` to `ClientConfig`, you don't need to pass it directly. Instead, the `ClientConfig` is set as an attribute of `global_config` (as shown in the example above).
Lastly, if you're working with multiple `CogniteClient` instances and making many concurrent requests, consider increasing the `max_connection_pool_size` in the `global_config` to efficiently reuse connections.
I hope this helps!
Let me know if you have any more questions or need further clarification.