Skip to content

Commit 3c36760

Browse files
committed
Only import api if actually used
1 parent 74143f8 commit 3c36760

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

simvue/worker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import threading
99
import msgpack
1010

11-
from .api import post, put
1211
from .metrics import get_process_memory, get_process_cpu, get_gpu_metrics
1312
from .utilities import get_offline_directory, create_file
1413

@@ -58,6 +57,7 @@ def heartbeat(self):
5857
Send a heartbeat
5958
"""
6059
if self._mode == 'online':
60+
from .api import put
6161
put(f"{self._url}/api/runs/heartbeat", self._headers, {'name': self._run_name})
6262
else:
6363
create_file(f"{self._directory}/heartbeat")
@@ -67,6 +67,7 @@ def post(self, endpoint, data):
6767
Send the supplied data
6868
"""
6969
if self._mode == 'online':
70+
from .api import post
7071
post(f"{self._url}/api/{endpoint}", self._headers_mp, data=data, is_json=False)
7172
else:
7273
unique_id = time.time()

0 commit comments

Comments
 (0)