ImportTasks method under %SYS.Task Class is not working for me
Hi, My python code to import a task is as below –
# dont disturb below lines
import irisnative
hostname = "127.0.0.1"
port = 1972
namespace = "%SYS" #change the namespace based on situation
username = "_SYSTEM"
password = "xxxxxxxx"
logfile = "exetask.log"
connection = irisnative.createConnection(hostname, port, namespace, username, password)
dbnative = irisnative.createIris(connection)
# dont disturb upto here
print("Importing LIS Backup Task")
imptask = dbnative.classMethodValue('%SYS.Task','ImportTasks(FileName = "F:\ZBackup\LISBackupTask.xml",qspec = "d")')
print("After Import LIS Backup Task: ",imptask)
# dont disturb below lines
connection.close()
# dont disturb upto here
The same LISBackupTask.xml I am able to load from Management portal. But when I use this class method the task is not getting loaded. Please suggest any solution to this problem.
ImportTasks() method returns a %Status that probably contains the answer you are looking for.
I'd suggest to check that.
Hi Enrico,
print("Importing LIS Backup Task")
imptask = dbnative.classMethodValue('%SYS.Task','ImportTasks(FileName = "F:\ZBackup\LISBackupTask.xml",qspec = "d")')
print("After Import LIS Backup Task: ",imptask)
The Python iterpreter is not executing the print statement after ImportTasks statement. MEans, the execution is not moving further and program is just coming out. Could be some method usage might be wrong. Plese let me know if i am doing any mistake or any other way i should provide the task details.
imptask = dbnative.classMethodValue('%SYS.Task','ImportTasks',"F:\Zbackup\LISBackupTask.xml","ck")
RuntimeError: server error 1217 <THROW> [ERROR_GENERAL_SERVER]
imptask = dbnative.classMethodValue('%SYS.Task','ImportTasks',"F\:\\Zbackup\\LISBackupTask\.xml","ck")
RuntimeError: * [ERROR_SHARED_CON_ERROR]
I am using IRIS Version as below -
IRIS for Windows (x86-64) 2023.1.2 (Build 450_0_23065U) Thu Dec 28 2023 14:31:25 EST [Health:5.1.0-1.m1]
and Native driver - i have downloaded the whl file "irisnative-1.0.0-cp34.cp35.cp36.cp37.cp38.cp39-none-win_amd64.whl" from GitHub
I'm not a python expert, but I'd try with:
imptask = dbnative.classMethodValue('%SYS.Task','ImportTasks',"F:\\Zbackup\\LISBackupTask.xml","ck")
This is the error i am getting
imptask = dbnative.classMethodValue('%SYS.Task','ImportTasks',"F:\\ZBackup\\LISBackupTask.xml","ck")
RuntimeError: server error 1217 <THROW> [ERROR_GENERAL_SERVER]
When i import the same file from TaskManager in Management Portal it is perfectly working and no errors. I need some solution to this problem. i got stuck due to this error.
I recommend reaching out to the WRC to help you dig into this specific error.
This is another case in which you're going to be happier using one of the newer wheels that comes with 2023.1.2. You're likely getting some kind of error on the server that the old 1.0.0 wheel cannot report back to you cleanly.
One thing you might try, if for some reason you're stuck on 1.0.0, is to add "-d" to the qspec argument. There's a really old bug/limitation, and I don't remember whether it was fixed on the client or server side, having to do with unexpected writes by a class method. "-d" would suppress that.
Hi John,
Actually i tried combinations like "d", "ck", "cdk" but nothing worked. Actually while importing the task at termainal using "do" did not worked for me. Then i used "obj=##class" then it worked.
To be clear, the recommendation is to add "-d", not "d". "d" displays output (the default); "-d" suppresses output. If that is indeed the bug you're running into, it is fixed in newer wheels.
Yes, i was talking about -d only. Can you please share the new wheel please.