Skip to content

Commit 888b23a

Browse files
committed
fix:PRComments
1 parent 74d488e commit 888b23a

File tree

7 files changed

+36
-24
lines changed

7 files changed

+36
-24
lines changed

docs/getting_started.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,18 +338,26 @@ default connection. The default connection depends on your environment.
338338

339339
With a :class:`.AssetManagementClient` object, you can:
340340

341-
* Create, delete, query assets and link files to assets.
342-
* Track asset utilization with start, heartbeat, end, and query history operations.
341+
**Asset Operations:**
343342

344-
Examples
345-
~~~~~~~~
343+
* Create, delete, query assets and link files to assets.
346344

347-
Create, delete, query assets, link files, and track asset utilization.
345+
Example:
348346

349347
.. literalinclude:: ../examples/assetmanagement/assets.py
350348
:language: python
351349
:linenos:
352350

351+
**Asset Utilization Operations:**
352+
353+
* Track asset utilization with start, heartbeat, end, and query history operations.
354+
355+
Example:
356+
357+
.. literalinclude:: ../examples/assetmanagement/asset_utilization.py
358+
:language: python
359+
:linenos:
360+
353361
Systems API
354362
-------
355363

examples/assetmanagement/asset_utilization.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from nisystemlink.clients.assetmanagement import AssetManagementClient
77
from nisystemlink.clients.assetmanagement.models import (
88
AssetBusType,
9-
AssetIdentificationModel,
9+
AssetIdentification,
1010
StartUtilizationRequest,
1111
)
1212
from nisystemlink.clients.core._http_configuration import HttpConfiguration
@@ -24,15 +24,15 @@
2424

2525
# Define the assets being used in the test
2626
test_assets = [
27-
AssetIdentificationModel(
27+
AssetIdentification(
2828
model_name="NI PXIe-6368",
2929
model_number=4000,
3030
serial_number="01BB877A",
3131
vendor_name="NI",
3232
vendor_number=4244,
3333
bus_type=AssetBusType.ACCESSORY,
3434
),
35-
AssetIdentificationModel(
35+
AssetIdentification(
3636
model_name="NI PXIe-5163",
3737
model_number=5000,
3838
serial_number="02CC988B",
@@ -66,19 +66,23 @@
6666

6767

6868
# Heartbeat mechanism using a background thread
69-
# IMPORTANT: Heartbeats must be sent at least every 5 minutes to keep assets
70-
# marked as "in use" in the SystemLink UI. If heartbeats stop, the assets
71-
# will no longer appear as actively utilized.
69+
# IMPORTANT: Heartbeats are for UI purposes only, to keep assets visually
70+
# marked as "in use" in the SystemLink UI. This applies only to utilizations
71+
# that have not been ended. While the standard heartbeat interval is 5 minutes,
72+
# the UI requires heartbeats at least every 10 minutes to continue showing
73+
# assets as actively utilized. If heartbeats stop, the assets will no longer
74+
# appear as "in use" in the UI.
7275
heartbeat_interval = 300 # 5 minutes in seconds
7376
is_active = True
7477

7578

7679
def heartbeat_loop():
7780
"""Background thread that sends periodic heartbeats.
7881
79-
This keeps the asset marked as "in use" in the SystemLink UI.
80-
Without periodic heartbeats (at least every 5 minutes), the UI
81-
will no longer show the asset as actively utilized.
82+
This keeps the asset visually marked as "in use" in the SystemLink UI
83+
(for UI purposes only). Applies only to utilizations that have not been ended.
84+
The UI requires heartbeats at least every 10 minutes to continue displaying
85+
the asset as actively utilized.
8286
"""
8387
while is_active:
8488
heartbeat_response = client.utilization_heartbeat(

nisystemlink/clients/assetmanagement/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
)
2828
from ._asset_utilization_history_item import AssetUtilizationHistoryItem
2929
from ._asset_utilization_history_response import AssetUtilizationHistoryResponse
30-
from ._asset_identification_model import AssetIdentificationModel
30+
from ._asset_identification import AssetIdentification
3131
from ._start_utilization_request import StartUtilizationRequest
3232
from ._start_utilization_partial_success_response import (
3333
StartUtilizationPartialSuccessResponse,

nisystemlink/clients/assetmanagement/models/_asset_identification_model.py renamed to nisystemlink/clients/assetmanagement/models/_asset_identification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ._asset_types import AssetBusType
88

99

10-
class AssetIdentificationModel(JsonModel):
10+
class AssetIdentification(JsonModel):
1111
"""Model for object containing properties which identify an asset.
1212
1313
An asset is uniquely identified by a combination of:

nisystemlink/clients/assetmanagement/models/_start_utilization_partial_success_response.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from nisystemlink.clients.core._api_error import ApiError
66
from nisystemlink.clients.core._uplink._json_model import JsonModel
77

8-
from ._asset_identification_model import AssetIdentificationModel
8+
from ._asset_identification import AssetIdentification
99

1010

1111
class StartUtilizationPartialSuccessResponse(JsonModel):
@@ -14,8 +14,8 @@ class StartUtilizationPartialSuccessResponse(JsonModel):
1414
error: Optional[ApiError] = None
1515
"""Error information if any failures occurred."""
1616

17-
assets_with_started_utilization: Optional[List[AssetIdentificationModel]] = None
17+
assets_with_started_utilization: Optional[List[AssetIdentification]] = None
1818
"""Array containing the asset identification data for the assets that started being utilized."""
1919

20-
failed: Optional[List[AssetIdentificationModel]] = None
20+
failed: Optional[List[AssetIdentification]] = None
2121
"""Array containing the asset identification data for the assets that failed to start being utilized."""

nisystemlink/clients/assetmanagement/models/_start_utilization_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from nisystemlink.clients.core._uplink._json_model import JsonModel
77

8-
from ._asset_identification_model import AssetIdentificationModel
8+
from ._asset_identification import AssetIdentification
99

1010

1111
class StartUtilizationRequest(JsonModel):
@@ -17,7 +17,7 @@ class StartUtilizationRequest(JsonModel):
1717
minion_id: Optional[str] = None
1818
"""Identifier of the minion where the utilized assets are located."""
1919

20-
asset_identifications: Optional[List[AssetIdentificationModel]] = None
20+
asset_identifications: Optional[List[AssetIdentification]] = None
2121
"""Array of the identification information for the assets which are utilized.
2222
The maximum number of asset identifications allowed per request is 100."""
2323

tests/integration/assetmanagement/test_asset_management.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
AssetBusType,
1010
AssetDiscoveryType,
1111
AssetField,
12-
AssetIdentificationModel,
12+
AssetIdentification,
1313
AssetLocationForCreate,
1414
AssetPresence,
1515
AssetPresenceStatus,
@@ -84,7 +84,7 @@ def _start_utilization(
8484
user_name: str,
8585
) -> None:
8686
asset_identifications = [
87-
AssetIdentificationModel(
87+
AssetIdentification(
8888
model_name=asset.model_name,
8989
model_number=asset.model_number,
9090
serial_number=asset.serial_number,
@@ -534,7 +534,7 @@ def test__start_utilization_with_nonexistent_asset__raises_ApiException(
534534
utilization_identifier=unique_identifier,
535535
minion_id="test-minion",
536536
asset_identifications=[
537-
AssetIdentificationModel(
537+
AssetIdentification(
538538
model_name="TestModel",
539539
serial_number="TEST123",
540540
vendor_name="TestVendor",

0 commit comments

Comments
 (0)