accsyn-python-api 3.0.1__tar.gz → 3.0.3__tar.gz

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.
Files changed (39) hide show
  1. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/PKG-INFO +1 -1
  2. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/misc.rst +3 -3
  3. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/release_notes.rst +19 -0
  4. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/setup.py +1 -1
  5. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_api/session.py +43 -22
  6. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_python_api.egg-info/PKG-INFO +1 -1
  7. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/.github/workflows/github-actions-black.yml +0 -0
  8. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/.gitignore +0 -0
  9. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/.pre-commit-config.yaml +0 -0
  10. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/.readthedocs.yaml +0 -0
  11. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/README.md +0 -0
  12. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/_static/accsyn.css +0 -0
  13. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/api_reference/index.rst +0 -0
  14. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/api_reference/session.rst +0 -0
  15. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/clients.rst +0 -0
  16. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/conf.py +0 -0
  17. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/datatypes.rst +0 -0
  18. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/file.rst +0 -0
  19. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/glossary.rst +0 -0
  20. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/index.rst +0 -0
  21. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/installing.rst +0 -0
  22. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/introduction.rst +0 -0
  23. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/jobs.rst +0 -0
  24. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/publish.rst +0 -0
  25. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/queues.rst +0 -0
  26. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/render.rst +0 -0
  27. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/requirements.txt +0 -0
  28. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/shares.rst +0 -0
  29. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/users.rst +0 -0
  30. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/doc/using.rst +0 -0
  31. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/pyproject.toml +0 -0
  32. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/readthedocs.yaml +0 -0
  33. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/setup.cfg +0 -0
  34. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_api/__init__.py +0 -0
  35. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_api/_version.py +0 -0
  36. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_python_api.egg-info/SOURCES.txt +0 -0
  37. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_python_api.egg-info/dependency_links.txt +0 -0
  38. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_python_api.egg-info/requires.txt +0 -0
  39. {accsyn-python-api-3.0.1 → accsyn-python-api-3.0.3}/source/accsyn_python_api.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accsyn-python-api
3
- Version: 3.0.1
3
+ Version: 3.0.3
4
4
  Summary: A Python API for accsyn programmable fast and secure data delivery software
5
5
  Home-page: https://github.com/accsyn/accsyn-python-api.git
6
6
  Author: Henrik Norin
@@ -20,11 +20,11 @@ Will return a string with your session key.
20
20
 
21
21
 
22
22
 
23
- Check if GUI or server is running::
23
+ Check if the accsyn app or daemon (user server) is running on the same machine and same user ID::
24
24
 
25
- session.gui_is_running()
25
+ session.app_is_running()
26
26
 
27
- session.server_is_running()
27
+ session.daemon_is_running()
28
28
 
29
29
  Will return True if GUI/Server is running, False if offline, None if not installed/detected.
30
30
 
@@ -13,6 +13,25 @@ Release Notes
13
13
 
14
14
  `https://support.accsyn.com <https://support.accsyn.com>`_.
15
15
 
16
+ .. release:: 3.0.3
17
+ :date: 2024-11-26
18
+
19
+ .. change:: changed
20
+
21
+ * Replaced 'gui_is_running' and 'app_is_running' with 'app_is_running' and 'deamon_is_running', keeping the old names for backwards compatibility.
22
+ * 'daemon_is_running' now properly checks for user clients on the same machine being of type server(workspace context) or user server (run by user daemon host).
23
+
24
+ .. change:: fix
25
+
26
+ * Fixed site query bug.
27
+
28
+ .. release:: 3.0.2
29
+ :date: 2024-11-18
30
+
31
+ .. change:: fix
32
+
33
+ * Replaced organization > workspace.
34
+
16
35
  .. release:: 3.0.1
17
36
  :date: 2024-11-18
18
37
 
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name='accsyn-python-api',
8
- version='3.0.1',
8
+ version='3.0.3',
9
9
  package_dir={'': 'source'},
10
10
  packages=['accsyn_api'],
11
11
  setup_requires=[
@@ -55,6 +55,18 @@ CLEARANCE_STANDARD = "standard"
55
55
  CLEARANCE_CLIENT = CLEARANCE_STANDARD # BWCOMP
56
56
  CLEARANCE_NONE = "none"
57
57
 
58
+ CLIENT_TYPE_APP = 0
59
+ CLIENT_TYPE_SERVER = 1
60
+ CLIENT_TYPE_USERSERVER = 2
61
+ CLIENT_TYPE_BROWSER = 3
62
+ CLIENT_TYPE_COMPUTE_LANE = 4
63
+ CLIENT_TYPE_ACCSYN_VPX = 5
64
+
65
+ CLIENT_STATE_INIT = "init"
66
+ CLIENT_STATE_ONLINE = "online"
67
+ CLIENT_STATE_OFFLINE = "offline"
68
+ CLIENT_STATE_DISABLED = "disabled"
69
+ CLIENT_STATE_DISABLED_OFFLINE = "disabled-offline"
58
70
 
59
71
  class JSONEncoder(json.JSONEncoder):
60
72
  """JSON serialiser."""
@@ -187,7 +199,7 @@ class Session(object):
187
199
  )
188
200
  if not domain:
189
201
  raise AccsynException(
190
- "Please supply your accsyn domain/organization or set " "ACCSYN_DOMAIN environment!"
202
+ "Please supply your accsyn domain/workspace or set " "ACCSYN_DOMAIN environment!"
191
203
  )
192
204
  if not username:
193
205
  username = os.environ.get("ACCSYN_API_USER")
@@ -430,7 +442,7 @@ class Session(object):
430
442
  data["skip"] = skip
431
443
  if attributes:
432
444
  data["attributes"] = attributes
433
- d = self._event("GET", "%s/find" % uri_base, data, query=d.get("expression"))
445
+ d = self._event("GET", "{}/find".format(uri_base), data, query=d.get("expression"))
434
446
  if d:
435
447
  retval = d["result"]
436
448
  return retval
@@ -802,7 +814,7 @@ class Session(object):
802
814
  data["include"] = include
803
815
  if exclude:
804
816
  data["exclude"] = exclude
805
- response = self._event("GET", "organization/file", data)
817
+ response = self._event("GET", "workspace/file", data)
806
818
  if response:
807
819
  return response["result"]
808
820
 
@@ -831,7 +843,7 @@ class Session(object):
831
843
  data["include"] = include
832
844
  if exclude:
833
845
  data["exclude"] = exclude
834
- response = self._event("GET", "organization/file", data)
846
+ response = self._event("GET", "workspace/file", data)
835
847
  if response:
836
848
  return response["result"]
837
849
 
@@ -849,7 +861,7 @@ class Session(object):
849
861
  "op": "exists",
850
862
  "path": path,
851
863
  }
852
- response = self._event("GET", "organization/file", data)
864
+ response = self._event("GET", "workspace/file", data)
853
865
  if response:
854
866
  return response["result"]
855
867
 
@@ -869,7 +881,7 @@ class Session(object):
869
881
  "op": "mkdir",
870
882
  "path": path,
871
883
  }
872
- response = self._event("POST", "organization/file", data)
884
+ response = self._event("POST", "workspace/file", data)
873
885
  if response:
874
886
  return response["result"]
875
887
 
@@ -894,7 +906,7 @@ class Session(object):
894
906
  "path": path,
895
907
  "path_to": path_to,
896
908
  }
897
- response = self._event("PUT", "organization/file", data)
909
+ response = self._event("PUT", "workspace/file", data)
898
910
  if response:
899
911
  return response["result"]
900
912
 
@@ -919,7 +931,7 @@ class Session(object):
919
931
  "path": path_src,
920
932
  "path_to": path_dst,
921
933
  }
922
- response = self._event("PUT", "organization/file", data)
934
+ response = self._event("PUT", "workspace/file", data)
923
935
  if response:
924
936
  return response["result"]
925
937
 
@@ -939,7 +951,7 @@ class Session(object):
939
951
  "op": "mkdir",
940
952
  "path": path,
941
953
  }
942
- response = self._event("POST", "organization/file", data)
954
+ response = self._event("POST", "workspace/file", data)
943
955
  if response:
944
956
  return response["result"]
945
957
 
@@ -966,7 +978,7 @@ class Session(object):
966
978
  return result
967
979
 
968
980
  event_data = {"files": data, "size": recursive_get_size(data)}
969
- response = self._event("PUT", "organization/publish/preprocess", event_data)
981
+ response = self._event("PUT", "workspace/publish/preprocess", event_data)
970
982
  return response["result"]
971
983
 
972
984
  # Settings
@@ -1001,8 +1013,14 @@ class Session(object):
1001
1013
  return self._event("GET", "user/api_key", {})["api_key"]
1002
1014
 
1003
1015
  def gui_is_running(self):
1016
+ """ Backward compability """
1017
+ return self.app_is_running()
1018
+
1019
+ def app_is_running(self):
1004
1020
  """
1005
- Check if a GUI is running on the same machine (hostname match) and with same username.
1021
+ Check if the accsyn desktop app is running on the same machine (code/hostname match) and with same user ID.
1022
+
1023
+ Equivalent to do client query with user, code and type.
1006
1024
 
1007
1025
  :return: True if found, False otherwise.
1008
1026
  """
@@ -1010,19 +1028,25 @@ class Session(object):
1010
1028
  "GET",
1011
1029
  "client/find",
1012
1030
  {},
1013
- query="user={0} AND code={1} AND type={2}".format(self._uid, Session.get_hostname(), 0),
1031
+ query="user={0} AND code={1} AND type={2}".format(self._uid, Session.get_hostname(), CLIENT_TYPE_APP),
1014
1032
  )["result"]
1015
1033
  retval = None
1016
1034
  if 0 < len(result):
1017
1035
  for c in result:
1018
- retval = c["status"] in ["online", "disabled"]
1036
+ retval = c["status"] in [CLIENT_STATE_ONLINE, CLIENT_STATE_DISABLED]
1019
1037
  if retval is True:
1020
1038
  break
1021
1039
  return retval
1022
1040
 
1023
1041
  def server_is_running(self):
1042
+ """ Backward compatibility """
1043
+ return self.daemon_is_running()
1044
+
1045
+ def daemon_is_running(self):
1024
1046
  """
1025
- Check if a server is running on the same machine with same username.
1047
+ Check if a daemon is running on the same machine (code/hostname match) with same user ID.
1048
+
1049
+ Equivalent to do client query with user, code and type.
1026
1050
 
1027
1051
  :return: True if found, False otherwise.
1028
1052
  """
@@ -1030,12 +1054,13 @@ class Session(object):
1030
1054
  "GET",
1031
1055
  "client/find",
1032
1056
  {},
1033
- query="user={0} AND code={1} AND type!={2}".format(self._uid, Session.get_hostname(), 0),
1057
+ query="user={0} AND code={1} AND (type={2} OR type={3})".format(self._uid, Session.get_hostname(),
1058
+ CLIENT_TYPE_SERVER, CLIENT_TYPE_USERSERVER),
1034
1059
  )["result"]
1035
1060
  retval = None
1036
1061
  if 0 < len(result):
1037
1062
  for c in result:
1038
- retval = c["status"] in ["online", "disabled"]
1063
+ retval = c["status"] in [CLIENT_STATE_ONLINE, CLIENT_STATE_DISABLED]
1039
1064
  if retval is True:
1040
1065
  break
1041
1066
  return retval
@@ -1046,7 +1071,7 @@ class Session(object):
1046
1071
  assert len(operation) > 0, 'No operation provided'
1047
1072
  return self._event(
1048
1073
  "PUT",
1049
- "organization/integration/{}/utility".format(name),
1074
+ "workspace/integration/{}/utility".format(name),
1050
1075
  {
1051
1076
  'operation': operation,
1052
1077
  'data': data,
@@ -1430,11 +1455,7 @@ class Session(object):
1430
1455
  def _get_base_uri(entitytype):
1431
1456
  uri_base = entitytype
1432
1457
  # Send query to server, first determine uri
1433
- # if entitytype == 'share':
1434
- # uri_base = 'organization/share'
1435
- if entitytype == "site":
1436
- uri_base = "organization/site"
1437
- elif entitytype == "queue":
1458
+ if entitytype == "queue":
1438
1459
  uri_base = "job"
1439
1460
  elif entitytype == "task":
1440
1461
  uri_base = "job/task"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accsyn-python-api
3
- Version: 3.0.1
3
+ Version: 3.0.3
4
4
  Summary: A Python API for accsyn programmable fast and secure data delivery software
5
5
  Home-page: https://github.com/accsyn/accsyn-python-api.git
6
6
  Author: Henrik Norin