Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 056f247

Browse files
authored
Merge pull request #1 from hatchet-dev/feat--overhaul-config
Feat: Overhaul config loading
2 parents 99f625f + a6d6a45 commit 056f247

File tree

10 files changed

+309
-258
lines changed

10 files changed

+309
-258
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,4 @@ cython_debug/
162162
#.idea/
163163

164164
openapitools.json
165+
.python-version

conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import os
23
import subprocess
34
import time
45
from io import BytesIO

hatchet_sdk/client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .clients.dispatcher.dispatcher import DispatcherClient, new_dispatcher
1313
from .clients.events import EventClient, new_event
1414
from .clients.rest_client import RestApi
15-
from .loader import ClientConfig, ConfigLoader
15+
from .loader import ClientConfig
1616

1717

1818
class Client:
@@ -37,11 +37,10 @@ def from_environment(
3737
loop = asyncio.new_event_loop()
3838
asyncio.set_event_loop(loop)
3939

40-
config: ClientConfig = ConfigLoader(".").load_client_config(defaults)
4140
for opt_function in opts_functions:
42-
opt_function(config)
41+
opt_function(defaults)
4342

44-
return cls.from_config(config, debug)
43+
return cls.from_config(defaults, debug)
4544

4645
@classmethod
4746
def from_config(
@@ -103,7 +102,7 @@ def __init__(
103102
self.config = config
104103
self.listener = RunEventListenerClient(config)
105104
self.workflow_listener = workflow_listener
106-
self.logInterceptor = config.logInterceptor
105+
self.logInterceptor = config.logger
107106
self.debug = debug
108107

109108

hatchet_sdk/hatchet.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from hatchet_sdk.features.cron import CronClient
1717
from hatchet_sdk.features.scheduled import ScheduledClient
1818
from hatchet_sdk.labels import DesiredWorkerLabel
19-
from hatchet_sdk.loader import ClientConfig, ConfigLoader
19+
from hatchet_sdk.loader import ClientConfig
2020
from hatchet_sdk.rate_limit import RateLimit
2121
from hatchet_sdk.v2.callable import HatchetCallable
2222

@@ -187,11 +187,8 @@ class HatchetRest:
187187
rest (RestApi): Interface for REST API operations.
188188
"""
189189

190-
rest: RestApi
191-
192190
def __init__(self, config: ClientConfig = ClientConfig()):
193-
_config: ClientConfig = ConfigLoader(".").load_client_config(config)
194-
self.rest = RestApi(_config.server_url, _config.token, _config.tenant_id)
191+
self.rest = RestApi(config.server_url, config.token, config.tenant_id)
195192

196193

197194
class Hatchet:

0 commit comments

Comments
 (0)