run keyword and return status get stuck before the keyword ends - robotframework

does anybody observed a fault where the
run keyword and return status get stuck and doesn't return from keyword ?
Its just not closing the keyword....
I was waiting 3 days... (ok it was weekend)
<kw name="Run Keyword And Return Status" library="BuiltIn">
<doc>Runs the given keyword with given arguments and returns the status as a Boolean value.</doc>
<arguments>
<arg>taut_ssh.SftpClient.File Should Exist</arg>
<arg>${filepath}${filePattern}</arg>
</arguments>
<assign>
<var>${ret}</var>
</assign>
<kw name="File Should Exist" library="taut_ssh.SftpClient">
<doc>Fails if the given `path` does NOT point to an existing file.</doc>
<arguments>
<arg>${filepath}${filePattern}</arg>
</arguments>
<msg timestamp="20200229 00:45:28.987" level="FAIL">file "/saps/tmn/GDI.PMAAV167.00.001.tgz" does not exist</msg>
<status status="FAIL" endtime="20200229 00:45:28.988" starttime="20200229 00:45:28.984"></status>
</kw>
<msg timestamp="20200229 00:45:28.988" level="INFO">${ret} = False</msg>
<status status="PASS" endtime="20200229 00:45:28.988" starttime="20200229

Related

Airflow Error callback "on_failure_callback" is not executing all the lines in the function

I have a problem in the usage of the on_failure_callback. I have defined my error callback function to perform 2 "http post" requests and I have added a logging.error( ) message between the two. I notice that only one is getting executed. Is there any delay or some thing that I am missing here?
please help.
def custom_failure_function(context):
logging.error("These task instances ahhh")
to_json= json.loads(t_teams)
var1= json.dumps(to_json)
print(var1)
r = requests.post('https://myteamschannel/teams', data=var1,verify=False)
logging.error("hello")
runID='OPERATION_CONTEXT .OCV8.TEST2 alarm_object 193'
headers = {'Content-Type':'text/xml'}
alarmRequest='<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:oper=\"http://172.19.146.147:7180/TeMIP_WS/services/OPERATION_CONTEXT-alarm_object\"><soapenv:Header xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsu:Created>2014-05-22T11:57:38.267Z</wsu:Created><wsu:Expires>2014-05-22T12:02:38.000Z</wsu:Expires></wsu:Timestamp><wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soapenv:mustUnderstand=\"1\"><wsse:UsernameToken xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsse:Username>girws</wsse:Username><wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">Temip</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header> <soapenv:Body> <oper:Set_Request xmlns:oper=\"http://172.19.146.147:7180/TeMIP_WS/services/OPERATION_CONTEXT-alarm_object\"><EntitySpec><Natural> '+ runID + '</Natural></EntitySpec><Arguments> <Attribute_Values><Filtering_Type>' + 'AUTOFAIL' + '</Filtering_Type></Attribute_Values></Arguments></oper:Set_Request> </soapenv:Body> </soapenv:Envelope>'
r = requests.post('http://myerrorappli:7180/TeMIP_WS/services/OPERATION_CONTEXT-alarm_object', header=headers, data=alarmRequest,verify=True)
logging.error ("FAILED TASK")
logging.error("============================================")
The logs of my airflow are below. Its stopping at the "hello" message and not printing "FAILED TASK".
*** Reading local file: /data/airflow//logs/MOE_TEST_DAG/TeamsTest/2021-10-02T08:24:14.821970+00:00/3.log
[2021-10-02 10:24:36,535] {MOE_TEST.py:132} ERROR - These task instances ahhh
[2021-10-02 10:24:36,987] {MOE_TEST.py:138} ERROR - hello
From your description it's more likely that there is an issue with requests.post() try to add timeout to the request:
def custom_failure_function(context):
...
try:
r = requests.post('http://myerrorappli:7180/TeMIP_WS/services/OPERATION_CONTEXT-alarm_object', header=headers,
data=alarmRequest, verify=True, timeout=5)
except requests.Timeout:
logging.error("request timeout")
except requests.ConnectionError:
logging.error("request connection error")
logging.error("FAILED TASK")
logging.error("============================================")

RobotScript - Catch Python Code Exception

We have a following code in Python
def function1()
...........
raise Exception ..
...............
return 0
Robot script:
${STATUS}= function1
Can anyone please let me know how in Robot script we can catch the return code / exception and branch accordingly?
Run Keyword And Return Status will return a boolean true/false did the enclose keyword succeed.
Run Keyword And Ignore Error returns a tuple of two values - the 1st is the string "PASS" or "FAIL" depending did your keyword succeed or not; the second - the keyword's return value if it passed, or any error messages if not.
Thus surround your keyword with one of these 2 - it really boils down to do you care about the returned value in success or the error in failure - and work with the returned values.
${passed}= Run Keyword And Return Status function1
Run Keyword If ${passed} Action When Passed ELSE Different Action
${rc} ${msg} Run Keyword And Ignore Error function1
Run Keyword If "${rc}" == 'PASS' Log The keyword returned the value: ${msg}
... ELSE Log The keyword failed with the message: ${msg}

Pointer.new(:uint) not converting to proper type for CoreMIDI (RubyMotion)

I'm trying to use CoreMIDI in a RubyMotion project. Here's a simple example of the code:
clientName = "Client"
clientRef = Pointer.new(:uint)
MIDIClientCreate( clientName, nil, nil, clientRef )
See more detailed code and backtrace in the following gist: https://gist.github.com/4299810
That code results in the following error:
(main)> 2012-12-15 14:43:27.410 core-midi-test[42560:c07]
app_delegate.rb:5:in application:didFinishLaunchingWithOptions:':
expected instance of Pointer of type^{OpaqueMIDIClient}', got I'
(TypeError) 2012-12-15 14:43:27.412 core-midi-test[42560:c07] ***
Terminating app due to uncaught exception 'TypeError', reason:
'app_delegate.rb:5:inapplication:didFinishLaunchingWithOptions:':
expected instance of Pointer of type ^{OpaqueMIDIClient}', gotI'
(TypeError)'
The error is apparently with the fourth argument to MIDIClientCreate. The docs for MIDIClientCreate show:
OSStatus MIDIClientCreate (
CFStringRef name,
MIDINotifyProc notifyProc,
void *notifyRefCon,
MIDIClientRef *outClient
);
MIDIClientRef derives from MIDIObjectRef which is defined as a UInt32, so I'm fairly certain that Pointer.new(:uint) is the correct type to use with RubyMotion.
Here is the pertinent portion of the CoreMIDI.bridgesupport file that RubyMotion is using:
<function name='MIDIClientCreate'>
<arg name='name' type='^{__CFString=}' declared_type='CFStringRef'/>
<arg name='notifyProc' function_pointer='true' type='^?' declared_type='MIDINotifyProc'>
<arg type='^{MIDINotification=iI}' declared_type='MIDINotification*' const='true'/>
<arg type='^v' declared_type='void*'/>
<retval type='v' declared_type='void'/>
</arg>
<arg name='notifyRefCon' type='^v' declared_type='void*'/>
<arg name='outClient' type='^^{OpaqueMIDIClient}' declared_type='MIDIClientRef*'/>
<retval type='l' declared_type='OSStatus'/>
</function>
As far as I can tell, the bridgesupport definition should include the necessary plumbing to make the proper conversion. But it's of course, not working.
Is there something wrong with my code or is there something wrong the CoreMIDI.bridgesupport file included with RubyMotion?
I found out by reading the documentation for MacRuby that one can explicitly pass the desired pointer type to the Pointer constructor like so:
clientName = "Client"
clientRef = Pointer.new(MIDIClientRef.type)
MIDIClientCreate( clientName, nil, nil, clientRef )
portName = "Output"
outport = Pointer.new(MIDIPortRef.type)
MIDIOutputPortCreate( clientRef[0], portName, outport )

"XMLCommand.initialize failed: java.lang.NullPointerException" when using dataset-proxy in a workflow databroker

I'm creating a workflow databroker, and in the pre-workflow I am using a dataset-proxy to iterate over the populate-dataset. However I get the following error when I compile:
XMLCommand.initialize failed: java.lang.NullPointerException
at nz.co.aviarc.xml.command.dataset.DatasetProxy.initialize(DatasetProxy.java:35)
at com.aviarc.framework.xml.command.XMLCommandElementImpl.finalize(XMLCommandElementImpl.java:90)
at com.aviarc.framework.xml.compilation.XMLSAXHandler.endElement(XMLSAXHandler.java:336)
at net.sf.saxon.event.ContentHandlerProxy.endElement(ContentHandlerProxy.java:391)
at net.sf.saxon.event.NamespaceReducer.endElement(NamespaceReducer.java:213)
at net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHandler.java:443)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:598)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:673)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1645)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:875)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1198)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:564)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:404)
at net.sf.saxon.event.Sender.send(Sender.java:193)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:30)
at com.aviarc.framework.xml.compilation.AviarcXMLResourceCompiler.compile(AviarcXMLResourceCompiler.java:137)
...
I get exactly the same error even when I use the code example straight out of the documentation (com.aviarc.dataset:1.1.0):
<workflow xmlns:ds="urn:aviarc:xmlcommand:com.aviarc.dataset">
<ds:dataset-proxy dataset="ds" proxyname="dsproxy">
<set-current-row dataset="dsproxy" position="2" />
<set-field field="dsproxy.email" value="test#test.com" />
</ds:dataset-proxy>
</workflow>
Turns out that the documentation is wrong, as proxyname is not a valid attribute on dataset-proxy. I didn't see it at first (because of the huge stack trace) but I was also getting this warning:
Unknown attribute 'proxyname'
The correct attribute is name, not proxyname. Changing this resolved the error.

Abort statement

I'm trying to abort a task in ada program but I get this error during compilation:
expect task name or task interface class-wide object for "abort"
The code looks like this:
task type Sending_Message;
type Send_Message is access Sending_Message;
declare
send : Send_Message;
begin
send := new Sending_Message;
...
abort send; -- this line throws error
end;
And again when I try line like this:
abort Sending_Message;
I get error:
invalid use of subtype mark in expression or call
Any idea what is wrong?
You have to explicitly dereference the access type:
abort send.all;

Resources