ironflock 1.0.5__py3-none-any.whl → 1.0.7__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.
ironflock/__init__.py CHANGED
@@ -7,4 +7,4 @@ from ironflock.ironflock import IronFlock
7
7
 
8
8
  __all__ = ["IronFlock", "create_application_component", "create_application_session"]
9
9
 
10
- __version__ = "1.0.5"
10
+ __version__ = "1.0.7"
ironflock/ironflock.py CHANGED
@@ -44,10 +44,8 @@ class IronFlock:
44
44
  async def onJoin(session, details):
45
45
  print("component joined")
46
46
  self._session = session
47
- self._main_task = asyncio.create_task(mainFunc())
48
-
49
47
  if self.mainFunc:
50
- await self.mainFunc()
48
+ self._main_task = asyncio.create_task(mainFunc())
51
49
 
52
50
  @self._component.on_disconnect
53
51
  @self._component.on_leave
@@ -138,13 +136,38 @@ class IronFlock:
138
136
  app_key = os.environ.get("APP_KEY")
139
137
  env_value = os.environ.get("ENV")
140
138
 
141
- topic = f"{swarm_key}.{self._device_key}.{app_key}.{env_value}.{topic}"
139
+ full_topic = f"{swarm_key}.{self._device_key}.{app_key}.{env_value}.{topic}"
142
140
 
143
141
  if self._session is not None:
144
- await self._session.register(topic, func, options=RegisterOptions(force_reregister=True))
142
+ await self._session.register(func, full_topic, options=RegisterOptions(force_reregister=True))
145
143
  else:
146
144
  print("cannot register function, not connected")
147
145
 
146
+ async def call(self, device_key, topic, args, kwargs):
147
+ """Calls a remote procedure on the IronFlock platform.
148
+
149
+ Args:
150
+ device_key (str): The key of the device to call the procedure on.
151
+ topic (str): The URI of the topic to call, e.g. "com.myprocedure".
152
+ args (list): The arguments to pass to the procedure.
153
+ kwargs (dict): The keyword arguments to pass to the procedure.
154
+
155
+ Returns:
156
+ The result of the remote procedure call.
157
+ """
158
+
159
+ swarm_key = os.environ.get("SWARM_KEY")
160
+ app_key = os.environ.get("APP_KEY")
161
+ env_value = os.environ.get("ENV")
162
+
163
+ full_topic = f"{swarm_key}.{device_key}.{app_key}.{env_value}.{topic}"
164
+
165
+ if self._session is not None:
166
+ return await self._session.call(full_topic, *args, **kwargs)
167
+ else:
168
+ print("cannot call, not connected")
169
+ return None
170
+
148
171
  async def publish_to_table(
149
172
  self, tablename: str, *args, **kwargs
150
173
  ) -> Optional[Publication]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ironflock
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: SDK to integrate your IronFlock Industry 4 Apps with the IronFlock Data Infrastructure
5
5
  Home-page: https://github.com/RecordEvolution/ironflock-py
6
6
  Author: Record Evolution GmbH
@@ -0,0 +1,8 @@
1
+ ironflock/AutobahnConnection.py,sha256=clwEsptqQFjDFn4dUGN4bQyb1cOnPmmNjetfTrRqckY,3687
2
+ ironflock/__init__.py,sha256=z-s5x1G27QSftSknNGAuwKSxF4xvxoktd9VVOFx6HW0,264
3
+ ironflock/ironflock.py,sha256=9zGmYVssBmMp4l_iceQc581aLu5-HieZIdRmBL2YkCE,7836
4
+ ironflock-1.0.7.dist-info/licenses/LICENSE,sha256=GpUKjPB381nmkbBIdX74vxXhsNZaNpngTOciss39Pjk,1073
5
+ ironflock-1.0.7.dist-info/METADATA,sha256=alvJX4W3cvxwoY4fNtzNJQZrN22TmIRcN88ONIsEoyQ,2764
6
+ ironflock-1.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ ironflock-1.0.7.dist-info/top_level.txt,sha256=hmMdMPJuvnOTlFKYl1XQOn81vg1DE2LT7xrEXgyxcRA,10
8
+ ironflock-1.0.7.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- ironflock/AutobahnConnection.py,sha256=clwEsptqQFjDFn4dUGN4bQyb1cOnPmmNjetfTrRqckY,3687
2
- ironflock/__init__.py,sha256=J5w21EeWOBHuxr98nMVMXAASa0tYnKppMluxtKL_x4U,264
3
- ironflock/ironflock.py,sha256=7ugUzrt1yCG_hJAlUKiyMqALZzhrvokHBOgsPDpLxgU,6906
4
- ironflock-1.0.5.dist-info/licenses/LICENSE,sha256=GpUKjPB381nmkbBIdX74vxXhsNZaNpngTOciss39Pjk,1073
5
- ironflock-1.0.5.dist-info/METADATA,sha256=9htX7guGxMP0xAqdOg-uWuyy8riEEs37LrPvV1gygQY,2764
6
- ironflock-1.0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- ironflock-1.0.5.dist-info/top_level.txt,sha256=hmMdMPJuvnOTlFKYl1XQOn81vg1DE2LT7xrEXgyxcRA,10
8
- ironflock-1.0.5.dist-info/RECORD,,