go to post Kevin McGinn · Jun 5, 2023 I resolved this issue. Permissions were incorrect on the new device. Missed this when reviewing the issue. Fixed the device permissions, shutdown the instance, updated the cache.cpf file, and re-started the instance
go to post Kevin McGinn · Dec 22, 2022 I found the best approach was with pythonbind: import intersys.pythonbind3 as pyb url = "localhost"userName= "???"password="???"port=1972 def main(): conn = pyb.connection() version = conn.get_implementation_version() conn.connect_now(f'[{url}][{port}]:%SYS', userName, password,None) # Create objects used to access cache/iris db = pyb.database(conn) qry = pyb.query (db) obj = pyb.object(db) ...... With the connection handle and the db, qry, obj objects you can use the methods and classes to access any database item in the cache database
go to post Kevin McGinn · Sep 20, 2022 Ok, trying to isolate my syntax error. I have re-reviewed the class specs but I am not seeing an issue. I have this: allocated = 0 used = 0 db = "/data/testdb/" global = "STRELPERF" # Set args to pass by reference list = [db,global,allocated,used] # exec the class method to get the global size res = self.db.run_class_method("%Library.GlobalEdit", "GetGlobalSize",list) This is the call that returns the failure status of res(0,). The associated error text is : ERROR #00: (no error description) Since for other databases that do not contain the global I get the error: ERROR #308: Global STRELPERF not found. It seems that code clip is close but something that I am not seeing is missing. Any help would be appreciated.
go to post Kevin McGinn · Sep 19, 2022 That is my point of confusion. The 'IsError' method returns a value of 1 which indicates an error. But the run_class_method() is returning valid allocated and used global sizes for the specified global. I am unclear how I am getting valid results and an error. These would seem to be mutually exclusive.
go to post Kevin McGinn · Apr 20, 2022 A more optimal processing loop: where hdl.run_obj_method("%Next",[status]): <process results>
go to post Kevin McGinn · Apr 20, 2022 I was able to resolve this issue by use the %Library.ResultSet' object '%New() method (python) hdl = self.db.run_class_method('%Library.ResultSet',"%Library.ResultSet',%New",[]) The setting the class name and query to be executed: hdl.set("ClassName","%SYSTEM.License") hdl.set("QueryName","Summary") This is then executed: hdl.run_obj_method("%Execute",[]) The results are process in a while loop while the value of: status = None conStat=True while conStat: lStat = hdl.run_obj_method("%Next",[status]) if lStat: < process results> conStat = lStat There may be more elegent refinements to this python solution but this does accurate extract and return the license usage summary data
go to post Kevin McGinn · Mar 23, 2022 In talking to Intersystems in regards to this issue, the query that I would need to use is not defined as a proc. Unknown if that will be corrected in the future or not. The prescribed solution was stated as: "...So the solution requires writing your own method in ObjectScript that uses %ResultSet to run the query. Your method then loops through the results, and creates something that can be returned. You call your method from Python" [ joel.solon@intersystems.com ] So I am closing this issue out. I may pursue that approach at a later date.
go to post Kevin McGinn · Mar 23, 2022 I resolved this issue. The intersys.pythonbind3 import on Windows references the dir "C:\Users\<user name>\AppData\Local\Programs\Python\Python37\Lib\site-packages\pythonbind3-1.0-py3.7-win-amd64.egg\intersys". I found that I can copy the contents of that dir to another windows server which allows the process to execute on a remote server even if cache is not installed on that remote server
go to post Kevin McGinn · Mar 11, 2022 This is a summary of the report that I am trying to create through a Python process: For the values in the "local" column I am using the %SYSTEM.License class and setting the values as follows: Current License Units Used - -> LUConsumed Maximum License Units Used --> LUMaxConsumed License Units Enforced --> KeyEnforcedUnits License Units Authorized --> KeyLicenseUnits Current Connections --> InstanceConnections Maximum Connections --> InstanceConnectionsMax The values appear to be match the Management Portal values. The instanceConnections and InstanceConnectionsMax in Python are Null so that is an open issue For the values in the "distributed" column are not completely clear. The first two values appear to be from the "%Monitor.SystemLicense" But this is my best guess. So for the distributed column I have: hdl = database.run_class_method("%Monitor.System.License","%New",[]) Current License Units Used - --> hdl.get('CurrentUsedDist') Maximum License Units Used -->hdl.get('MaxUsedDist') License Units Enforced --> ? License Units Authorized --> ? Current Connections --> ? Maximum Connections --> ? At this point I would like know how to get the missing distributed license values. Also, is the "%Monitor.System.License" the correct source for some of the distributed values?
go to post Kevin McGinn · Mar 11, 2022 I am not sure what screen shot would be helpful. I did find that the class ""%Monitor.System.License" contains the distributed license parameters that I need. What I am trying to figure out is the correct syntax to get a handle to the object. I tried: hdl = database.openid("%Monitor.System.License",'',-1,-1) But this fails. I also tried: hdl = database.run_class_method("%Monitor.System.License","%OpenId",[]) But this object does not have the '%OpenId' method If I can figure the correct syntax I can use hdl.get(xx) to get what I need for the distributed license attributes.
go to post Kevin McGinn · Mar 10, 2022 That is helpful but I still have open issues. I am trying to determine why instanceConnections() instanceConnectionsMax() produce the correct answers in a Terminal session but return None in Python. I also, if it is available would like to know where to find the values to use for the 'Distributed' column of that web page
go to post Kevin McGinn · Mar 5, 2022 Thank-you for the response. I now have found the class reference for 2017 where it is specified as a method as opposed to a classmethod. Would you mind elaborating a bit on your statement "...wrap it in a class method". I see that in object script there is the $METHOD() which appears to be what I need but I am not find finding an equivalent python method.
go to post Kevin McGinn · Mar 4, 2022 I have resolved this issue. I used: execRes = qry.prepare_class("SYS.Database",'CompactLocalList') to get basic information on each of the databases. I then used object getters to get the other property values I needed. To get a object handle to each database I used: _db = db.openid('SYS.Database', <database dir>,-1,-1) Then <prop value = _db.get(<property name>)
go to post Kevin McGinn · Mar 3, 2022 I know this is an old post but I am having the same issue as detailed in this ticket using cache 2017.1.2. This is a client instance and upgrading to something current is not an option near term. I am rather new to accessing cache with Python so my error may be rather basic. You stated that use can use the query "select DatabaseName, Directory....FROM SYS.Database_FreeSpace('*')". I have have trouble with the syntax apparently. I have the statement: query.prepare("select * from SYS.Database_FreeSpace('*')") but that fails with: intersys.pythonbind3.cache_exception: file=intersys/pythonbind3.c line=3355 err=-1 message=cbind_prepare_gen_query() I am obviously missing something.
go to post Kevin McGinn · Mar 1, 2022 Thank-you for your reply. I know cache is 64bit; I believe intersys.pythonbind3 is also 64bit though I am not entirely clear about how to validate that. The connection to the database works correctly. The following method calls with the connection work correctly: db.run_class_method("%SYSTEM.INetInfo","LocalHostName",[])db.run_class_method("%SYSTEM.Version","SystemMode",[])db.run_class_method("%SYSTEM.Util","InstallDirectory",[])db.run_class_method("%SYSTEM.Util","ManagerDirectory",[])db.run_class_method("%SYSTEM.Util","NumberOfCPUs",[]) This is what makes the issue confusing. This intersys lib. appears to have the tools I need but perhaps I should revisit ODBC. I see the cache query builder is also based upon ODBC so perhaps that is the actual fix.
go to post Kevin McGinn · Feb 1, 2022 I trying using the 'Do ^%RFIND' to determine the routines referencing the global. I specified 'STRELPERF' to search for and I stipulated to ignore case. Nothing was found. That doesn't make since since the global is 700+G in size. So I must be doing something incorrect. If they are application specific globals as noted I will again ask the client for details.
go to post Kevin McGinn · Jan 26, 2022 I believe that I was able to answer my own question. In a csession I used the command "DO ^%GSIZE". I specified the database path and the global of interest - in this case - STMONITS . The command generated the information I needed.