on 2021 Nov 09 11:47 AM
So basically for no delta records at the source side - If we run a graph, We get the no output the "ABAP CDS Reader v2",
So How can i detect a "No Delta Records" operation in a python operator for certain period of time and if no delta is there i will do some operations in the same script!
I tried with port_callback function but it will call the function only when there is any input comes up.
So any Python script template/way how can i detect this?
Thanks,
Samarth
Request clarification before answering.
Yeah we can use it but how can i put this in my code?
1. It should get rid of counter as soon as the Delta is there and
2. It should wait for "Delta" to come up for like 5 mins and if no delta then write an empty file in the destination.
Can you elaborate more considering the above requirements?
Thanks,
Samarth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Samarth,
There are even more examples on the help docs here - https://help.sap.com/viewer/97fce0b6d93e490fadec7e7021e9016e/Cloud/en-US/021180336add475bbd712b0ce5d...
You should be able to add the port callback and timer into the operator script. The timer would start when the operator starts, but the operator is also waiting for input on the inbound port. You would just need to reset the timer as part of your port callback function when it receives data on the inbound port.
Hope this helps! Share your code if you get it working.
Check out the example code in the standard Python3 operator. Could a generator or timer work for your scenario?
# # Generators
# # When using the snippet below make sure you create an output port of type int64
# counter = 0
#
# def gen():
# global counter
# for i in range(0, 3):
# api.send("output", counter)
# counter += 1
#
# api.add_generator(gen)
# api.add_generator(gen) # Adding the generator twice will make the function be executed twice.
# # Timer
# # When using the snippet below make sure you create an output port of type int64
# counter = 0
#
# def t1():
# global counter
# api.send("output", counter)
# counter += 1
#
# api.add_timer("1s", t1)
# # Timer
# # When using the snippet below make sure you create an output port of type string
# counter = 0
#
# def t2():
# global counter
# api.send("output", str(counter))
# counter += 1
#
# api.add_timer("1s", t2)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
42 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.