wmill 1.295.4__py3-none-any.whl → 1.296.1__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.

Potentially problematic release.


This version of wmill might be problematic. Click here for more details.

wmill/client.py CHANGED
@@ -346,6 +346,24 @@ class Windmill:
346
346
  def set_state(self, value: Any):
347
347
  self.set_resource(value, path=self.state_path, resource_type="state")
348
348
 
349
+ def set_flow_user_state(self, key: str, value: Any) -> None:
350
+ """Set the user state of a flow at a given key"""
351
+ flow_id = self.get_root_job_id()
352
+ r = client.post(f"/w/{self.workspace}/jobs/flow/user_states/{flow_id}/{key}", json=value, raise_for_status=False)
353
+ if r.status_code == 404:
354
+ print(f"Job {flow_id} does not exist or is not a flow")
355
+
356
+
357
+ def get_flow_user_state(self, key: str) -> Any:
358
+ """Get the user state of a flow at a given key"""
359
+ flow_id = self.get_root_job_id()
360
+ r = client.get(f"/w/{self.workspace}/jobs/flow/user_states/{flow_id}/{key}", raise_for_status=False)
361
+ if r.status_code == 404:
362
+ print(f"Job {flow_id} does not exist or is not a flow")
363
+ return None
364
+ else:
365
+ return r.json()
366
+
349
367
  @property
350
368
  def version(self):
351
369
  return self.get("version").text
@@ -851,6 +869,21 @@ def set_variable(path: str, value: str, is_secret: bool = False) -> None:
851
869
  return _client.set_variable(path, value, is_secret)
852
870
 
853
871
 
872
+ @init_global_client
873
+ def get_flow_user_state(key: str) -> Any:
874
+ """
875
+ Get the user state of a flow at a given key
876
+ """
877
+ return _client.get_flow_user_state(key)
878
+
879
+ @init_global_client
880
+ def set_flow_user_state(key: str, value: Any) -> None:
881
+ """
882
+ Set the user state of a flow at a given key
883
+ """
884
+ return _client.set_flow_user_state(key, value)
885
+
886
+
854
887
  @init_global_client
855
888
  def get_state_path() -> str:
856
889
  return _client.state_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wmill
3
- Version: 1.295.4
3
+ Version: 1.296.1
4
4
  Summary: A client library for accessing Windmill server wrapping the Windmill client API
5
5
  Home-page: https://windmill.dev
6
6
  License: Apache-2.0
@@ -1,8 +1,8 @@
1
1
  wmill/__init__.py,sha256=nGZnQPezTdrBnBW1D0JqUtm75Gdf_xi3tAcPGwHRZ5A,46
2
- wmill/client.py,sha256=o5M-tuAsSxaO1wZpOJgVzxmrh-V8Y1ogfhzXk-I1L6U,30134
2
+ wmill/client.py,sha256=19M0o5gxuqx3m1A1DVfAWqofzGW_DNzKxuknxwaGveY,31315
3
3
  wmill/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
4
4
  wmill/s3_reader.py,sha256=ZznXPIdMkP7S17CJ5scBJAyLDHBKAaqZB-B_l9pRIzA,1575
5
5
  wmill/s3_types.py,sha256=axVibTMtpynBwaCVK0O6bBao56no01qflyIGRaVyV6s,1149
6
- wmill-1.295.4.dist-info/METADATA,sha256=lgRBDC9Rr_VE9hTJOUVNXYHq0i1bI8vgrpTBuG388FE,2699
7
- wmill-1.295.4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
8
- wmill-1.295.4.dist-info/RECORD,,
6
+ wmill-1.296.1.dist-info/METADATA,sha256=cAeI87RCWrVJvhMiCg7nuLzjLQmp_MfqncmjK9fehfQ,2699
7
+ wmill-1.296.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
8
+ wmill-1.296.1.dist-info/RECORD,,