matrice-compute 0.1.34__py3-none-any.whl → 0.1.35__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -495,6 +495,10 @@ class ActionInstance:
495
495
  # Build container name option if provided
496
496
  name_option = f"--name {container_name}" if container_name else ""
497
497
 
498
+ # if the service provider is local, then put --restart unless-stopped
499
+ if os.environ.get("SERVICE_PROVIDER") in ("local", "LOCAL"):
500
+ env_exports += " && export DOCKER_RESTART_POLICY='--restart unless-stopped' "
501
+
498
502
  cmd_parts = [
499
503
  f"docker run -d {use_gpu} ",
500
504
  name_option,
@@ -1271,7 +1275,7 @@ def database_setup_execute(self: ActionInstance):
1271
1275
  )
1272
1276
  self.docker_container = existing_container_id
1273
1277
  cmd = "docker restart " + self.docker_container
1274
- self.start(cmd, "qdrant_setup")
1278
+ self.start(cmd, "database_setup")
1275
1279
 
1276
1280
  # qdrant restart
1277
1281
  qdrant_cmd = f"docker restart {qdrant_container_name}"
@@ -1285,11 +1289,15 @@ def database_setup_execute(self: ActionInstance):
1285
1289
  )
1286
1290
  # Fall through to create new containers
1287
1291
 
1292
+ dbPath = action_details["jobParams"].get("dbPath", "/host/data/path/mongodb_data")
1293
+
1288
1294
  # MongoDB container with --net=host (Port: 27020:27017)
1289
1295
  cmd = (
1290
1296
  f"docker run --pull=always --net=host "
1291
1297
  f"--name {mongodb_container_name} "
1292
1298
  f"-v matrice_myvol:/matrice_data "
1299
+ f"-v {dbPath}:{dbPath} "
1300
+ f"-v /var/run/docker.sock:/var/run/docker.sock "
1293
1301
  f"--cidfile ./{self.action_record_id}.cid "
1294
1302
  f"-e ACTION_RECORD_ID={self.action_record_id} "
1295
1303
  f"-e MATRICE_ACCESS_KEY_ID={self.matrice_access_key_id} "
@@ -1298,22 +1306,29 @@ def database_setup_execute(self: ActionInstance):
1298
1306
  f'-e ENV="{os.environ.get("ENV", "prod")}" '
1299
1307
  f"{image} "
1300
1308
  )
1301
- logging.info("Starting MongoDB container (Port: 27020:27017): %s", cmd)
1309
+ logging.info("Starting DB container (Port: 27020:27017): %s", cmd)
1302
1310
 
1303
1311
  # Qdrant container with --net=host (Port: 6334)
1304
1312
  qdrant_cmd = (
1305
- f"docker run --pull=always --net=host "
1313
+ f"docker run -d --pull=always --net=host "
1306
1314
  f"--name {qdrant_container_name} "
1307
1315
  f"-v matrice_myvol:/matrice_data "
1308
- f"{'qdrant/qdrant:latest'} "
1316
+ f"qdrant/qdrant:latest "
1309
1317
  )
1310
1318
  logging.info("Starting Qdrant container (Port: 6334): %s", qdrant_cmd)
1311
1319
 
1320
+ # Start Qdrant container
1321
+ qdrant_process = subprocess.Popen(
1322
+ qdrant_cmd,
1323
+ shell=True,
1324
+ stdout=subprocess.PIPE,
1325
+ stderr=subprocess.PIPE,
1326
+ )
1327
+ logging.info("Qdrant container started successfully")
1328
+
1312
1329
  # Docker Command run
1313
1330
  self.start(cmd, "database_setup")
1314
1331
 
1315
- # Docker for qdrant
1316
- self.start(qdrant_cmd, 'qdrant_setup')
1317
1332
 
1318
1333
  @log_errors(raise_exception=False)
1319
1334
  def facial_recognition_setup_execute(self: ActionInstance):
@@ -1359,6 +1374,7 @@ def facial_recognition_setup_execute(self: ActionInstance):
1359
1374
  f'-e MATRICE_SECRET_ACCESS_KEY="{self.matrice_secret_access_key}" '
1360
1375
  f'-e MATRICE_ACCESS_KEY_ID="{self.matrice_access_key_id}" '
1361
1376
  f'-e ACTION_ID="{self.action_record_id}" '
1377
+ f' --restart=unless-stopped '
1362
1378
  f"{image}"
1363
1379
  )
1364
1380
  logging.info("Starting facial recognition worker (Port: 8081): %s", worker_cmd)
@@ -1411,6 +1427,7 @@ def lpr_setup_execute(self: ActionInstance):
1411
1427
  f'-e MATRICE_ACCESS_KEY_ID="{self.matrice_access_key_id}" '
1412
1428
  f'-e ACTION_ID="{self.action_record_id}" '
1413
1429
  f'-e PORT=8082 '
1430
+ f' --restart=unless-stopped '
1414
1431
  f"{image}"
1415
1432
  )
1416
1433
  logging.info("Starting LPR worker (Port: 8082): %s", worker_cmd)
@@ -1469,6 +1486,7 @@ def inference_ws_server_execute(self: ActionInstance):
1469
1486
  f'-e ENV="{os.environ.get("ENV", "prod")}" '
1470
1487
  f'-e MATRICE_SECRET_ACCESS_KEY="{self.matrice_secret_access_key}" '
1471
1488
  f'-e MATRICE_ACCESS_KEY_ID="{self.matrice_access_key_id}" '
1489
+ f' --restart=unless-stopped '
1472
1490
  f"{image} "
1473
1491
  f"./app "
1474
1492
  f"{self.action_record_id} "
@@ -1530,6 +1548,7 @@ def fe_fs_streaming_execute(self: ActionInstance):
1530
1548
  f'-e MATRICE_ACCESS_KEY_ID="{self.matrice_access_key_id}" '
1531
1549
  f"-e PORT=3000 "
1532
1550
  f'-e WS_HOST="{ws_url}" '
1551
+ f' --restart=unless-stopped '
1533
1552
  f"{image}"
1534
1553
  )
1535
1554
  logging.info("Starting frontend streaming (Port: 3000) with WS_HOST=%s: %s", ws_url, worker_cmd)
@@ -1585,6 +1604,7 @@ def fe_analytics_service_execute(self: ActionInstance):
1585
1604
  f'-e ACTION_ID="{self.action_record_id}" '
1586
1605
  f"-e PORT=3001 "
1587
1606
  f'-e PROJECT_ID="{project_id}" '
1607
+ f' --restart=unless-stopped '
1588
1608
  f"{image}"
1589
1609
  )
1590
1610
  logging.info("Starting frontend analytics service (Port: 3001): %s", worker_cmd)
@@ -2194,6 +2214,7 @@ def inference_tracker_setup_execute(self: ActionInstance):
2194
2214
  f'-e MATRICE_SECRET_ACCESS_KEY="{self.matrice_secret_access_key}" '
2195
2215
  f'-e MATRICE_ACCESS_KEY_ID="{self.matrice_access_key_id}" '
2196
2216
  f'-e ACTION_ID="{self.action_record_id}" '
2217
+ f' --restart=unless-stopped '
2197
2218
  f"{image}"
2198
2219
  )
2199
2220
 
@@ -2235,6 +2256,7 @@ def video_storage_setup_execute(self: ActionInstance):
2235
2256
  f'-e MATRICE_SECRET_ACCESS_KEY="{self.matrice_secret_access_key}" '
2236
2257
  f'-e MATRICE_ACCESS_KEY_ID="{self.matrice_access_key_id}" '
2237
2258
  f'-e ACTION_ID="{self.action_record_id}" '
2259
+ f'--restart=unless-stopped '
2238
2260
  f"{image}"
2239
2261
  )
2240
2262
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_compute
3
- Version: 0.1.34
3
+ Version: 0.1.35
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
1
  matrice_compute/__init__.py,sha256=YZhx7rQlD1TAlhBMbsU3_Xp-tpLyTAxWZDcQvqmwR2g,723
2
- matrice_compute/action_instance.py,sha256=GF49-yYJp_5EHZ6ZT5kY4U-y1zyPkFjjDt1xMb2BaIg,87439
2
+ matrice_compute/action_instance.py,sha256=zVsW7-O3u5QoeZlh2D9Qlo5HsQNMOrUGbaR1jY1QFFg,88286
3
3
  matrice_compute/actions_manager.py,sha256=a_TulMnu462xc0t_A-Mpug5zhQTmtpjiv7mhiC_IAVw,18280
4
4
  matrice_compute/actions_scaledown_manager.py,sha256=pJ0nduNwHWZ10GnqJNx0Ok7cVWabQ_M8E2Vb9pH3A_k,2002
5
5
  matrice_compute/compute_operations_handler.py,sha256=amcMhmXtv2irE6qK8Vbgec_8uFqjWmVVp0VWq-73_MU,17781
@@ -11,8 +11,8 @@ matrice_compute/resources_tracker.py,sha256=DffKitGU1gran0OAuKIsfH0XeOe03xU7NGl-
11
11
  matrice_compute/scaling.py,sha256=UQDI8wN9JEKafvUVPF0Pk9XmhKlbMkeu16AZyyOuSE8,55147
12
12
  matrice_compute/shutdown_manager.py,sha256=rnP9Qes6JJKDnebmBC9rqkH__X9a8TMjhWQPWoOQKFs,13232
13
13
  matrice_compute/task_utils.py,sha256=3qIutiQdYPyGRxH9ZwLbqdg8sZcnp6jp08pszWCRFl0,2820
14
- matrice_compute-0.1.34.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
15
- matrice_compute-0.1.34.dist-info/METADATA,sha256=K4c_uaSlUeEbbC7yWB9RzW_qvLoxfgwGOk94BbbtaQs,1038
16
- matrice_compute-0.1.34.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- matrice_compute-0.1.34.dist-info/top_level.txt,sha256=63Plr3L1GzBUWZO5JZaFkiv8IcB10xUPU-9w3i6ptvE,16
18
- matrice_compute-0.1.34.dist-info/RECORD,,
14
+ matrice_compute-0.1.35.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
15
+ matrice_compute-0.1.35.dist-info/METADATA,sha256=iP3k-FJhne2q4kbSSZx6IcTX1MPDr5upMcFeG0I_z6g,1038
16
+ matrice_compute-0.1.35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ matrice_compute-0.1.35.dist-info/top_level.txt,sha256=63Plr3L1GzBUWZO5JZaFkiv8IcB10xUPU-9w3i6ptvE,16
18
+ matrice_compute-0.1.35.dist-info/RECORD,,