'Publish' not happening until script is done

#1

I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, all its calls to session.publish() are ignored until the script is done. As soon as the time is up, all messages are published in a flood.

I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during the run as expected).

My script is long, complex and includes a combined frontend and backend for Crossbar/Twisted/Autobahn. I feel I would risk misreporting if I tried to condense and include it.

What possible reason is there for publish to not happen instantaneously?

0 Likes

#2

your script isn’t performing asynchronously

···

On Wed, Jan 10, 2018 at 7:01 AM sscirrus sanjee...@gmail.com wrote:

I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, all its calls to session.publish() are ignored until the script is done. As soon as the time is up, all messages are published in a flood.

I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during the run as expected).

My script is long, complex and includes a combined frontend and backend for Crossbar/Twisted/Autobahn. I feel I would risk misreporting if I tried to condense and include it.

What possible reason is there for publish to not happen instantaneously?

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/5c04c639-d1d7-45ca-81cd-994dc9abe84e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

Thanks for your message.

Here below is a specific example. How can I get the two publish commands in my_script() to publish 2s apart as the code suggests?

@component.on_join

@inlineCallbacks

def join(session, details):

print(“joined {}: {}”.format(session, details))

     def publish(value):

session.publish(u’com.asdf.ghjk’, {“value”: value})

pass

def my_script(thing):

publish(‘TEST 1’)
sleep(2)

publish(‘TEST 2’)

try:

yield session.register(my_script, u’com.asdf.ghjk’)

except Exception as e:

print(“could not register procedure: {0}”.format(e))

``

···

On Wednesday, January 10, 2018 at 10:35:36 PM UTC-5, David Ford wrote:

your script isn’t performing asynchronously

On Wed, Jan 10, 2018 at 7:01 AM sscirrus sanj...@gmail.com wrote:

I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, all its calls to session.publish() are ignored until the script is done. As soon as the time is up, all messages are published in a flood.

I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during the run as expected).

My script is long, complex and includes a combined frontend and backend for Crossbar/Twisted/Autobahn. I feel I would risk misreporting if I tried to condense and include it.

What possible reason is there for publish to not happen instantaneously?

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/5c04c639-d1d7-45ca-81cd-994dc9abe84e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#4

is your tool based on asyncio or twisted?

···

On Thu, Jan 11, 2018 at 1:03 AM sscirrus sanjee...@gmail.com wrote:

Thanks for your message.

Here below is a specific example. How can I get the two publish commands in my_script() to publish 2s apart as the code suggests?

@component.on_join

@inlineCallbacks

def join(session, details):

print(“joined {}: {}”.format(session, details))

     def publish(value):

session.publish(u’com.asdf.ghjk’, {“value”: value})

pass

def my_script(thing):

publish(‘TEST 1’)
sleep(2)

publish(‘TEST 2’)

try:

yield session.register(my_script, u’com.asdf.ghjk’)

except Exception as e:

print(“could not register procedure: {0}”.format(e))

``

On Wednesday, January 10, 2018 at 10:35:36 PM UTC-5, David Ford wrote:

your script isn’t performing asynchronously

On Wed, Jan 10, 2018 at 7:01 AM sscirrus sanj...@gmail.com wrote:

I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, all its calls to session.publish() are ignored until the script is done. As soon as the time is up, all messages are published in a flood.

I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during the run as expected).

My script is long, complex and includes a combined frontend and backend for Crossbar/Twisted/Autobahn. I feel I would risk misreporting if I tried to condense and include it.

What possible reason is there for publish to not happen instantaneously?

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobah...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/5c04c639-d1d7-45ca-81cd-994dc9abe84e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/f1452e40-edc2-43cc-8e58-a2a5872984c2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#5

Twisted. With Crossbar and Autobahn.

···

On Sunday, January 14, 2018 at 9:16:06 PM UTC-5, David Ford wrote:

is your tool based on asyncio or twisted?

On Thu, Jan 11, 2018 at 1:03 AM sscirrus sanj...@gmail.com wrote:

Thanks for your message.

Here below is a specific example. How can I get the two publish commands in my_script() to publish 2s apart as the code suggests?

@component.on_join

@inlineCallbacks

def join(session, details):

print(“joined {}: {}”.format(session, details))

     def publish(value):

session.publish(u’com.asdf.ghjk’, {“value”: value})

pass

def my_script(thing):

publish(‘TEST 1’)
sleep(2)

publish(‘TEST 2’)

try:

yield session.register(my_script, u’com.asdf.ghjk’)

except Exception as e:

print(“could not register procedure: {0}”.format(e))

``

On Wednesday, January 10, 2018 at 10:35:36 PM UTC-5, David Ford wrote:

your script isn’t performing asynchronously

On Wed, Jan 10, 2018 at 7:01 AM sscirrus sanj...@gmail.com wrote:

I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, all its calls to session.publish() are ignored until the script is done. As soon as the time is up, all messages are published in a flood.

I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during the run as expected).

My script is long, complex and includes a combined frontend and backend for Crossbar/Twisted/Autobahn. I feel I would risk misreporting if I tried to condense and include it.

What possible reason is there for publish to not happen instantaneously?

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/5c04c639-d1d7-45ca-81cd-994dc9abe84e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/f1452e40-edc2-43cc-8e58-a2a5872984c2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#6

look at reactor.callLater(secs, callback, …)

···

On Sun, Jan 14, 2018 at 11:14 PM sscirrus sanjee...@gmail.com wrote:

Twisted. With Crossbar and Autobahn.

On Sunday, January 14, 2018 at 9:16:06 PM UTC-5, David Ford wrote:

is your tool based on asyncio or twisted?

On Thu, Jan 11, 2018 at 1:03 AM sscirrus sanj...@gmail.com wrote:

Thanks for your message.

Here below is a specific example. How can I get the two publish commands in my_script() to publish 2s apart as the code suggests?

@component.on_join

@inlineCallbacks

def join(session, details):

print(“joined {}: {}”.format(session, details))

     def publish(value):

session.publish(u’com.asdf.ghjk’, {“value”: value})

pass

def my_script(thing):

publish(‘TEST 1’)
sleep(2)

publish(‘TEST 2’)

try:

yield session.register(my_script, u’com.asdf.ghjk’)

except Exception as e:

print(“could not register procedure: {0}”.format(e))

``

On Wednesday, January 10, 2018 at 10:35:36 PM UTC-5, David Ford wrote:

your script isn’t performing asynchronously

On Wed, Jan 10, 2018 at 7:01 AM sscirrus sanj...@gmail.com wrote:

I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, all its calls to session.publish() are ignored until the script is done. As soon as the time is up, all messages are published in a flood.

I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during the run as expected).

My script is long, complex and includes a combined frontend and backend for Crossbar/Twisted/Autobahn. I feel I would risk misreporting if I tried to condense and include it.

What possible reason is there for publish to not happen instantaneously?

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobah...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/5c04c639-d1d7-45ca-81cd-994dc9abe84e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobah...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/f1452e40-edc2-43cc-8e58-a2a5872984c2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/d575e5dd-62e4-4622-9699-4e5f95911a55%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#7

Thanks.

···

On Monday, January 15, 2018 at 3:04:10 AM UTC-5, David Ford wrote:

look at reactor.callLater(secs, callback, …)

On Sun, Jan 14, 2018 at 11:14 PM sscirrus sanj...@gmail.com wrote:

Twisted. With Crossbar and Autobahn.

On Sunday, January 14, 2018 at 9:16:06 PM UTC-5, David Ford wrote:

is your tool based on asyncio or twisted?

On Thu, Jan 11, 2018 at 1:03 AM sscirrus sanj...@gmail.com wrote:

Thanks for your message.

Here below is a specific example. How can I get the two publish commands in my_script() to publish 2s apart as the code suggests?

@component.on_join

@inlineCallbacks

def join(session, details):

print(“joined {}: {}”.format(session, details))

     def publish(value):

session.publish(u’com.asdf.ghjk’, {“value”: value})

pass

def my_script(thing):

publish(‘TEST 1’)
sleep(2)

publish(‘TEST 2’)

try:

yield session.register(my_script, u’com.asdf.ghjk’)

except Exception as e:

print(“could not register procedure: {0}”.format(e))

``

On Wednesday, January 10, 2018 at 10:35:36 PM UTC-5, David Ford wrote:

your script isn’t performing asynchronously

On Wed, Jan 10, 2018 at 7:01 AM sscirrus sanj...@gmail.com wrote:

I have a Python script that sometimes runs a process that lasts ~5-60 seconds. During this time, all its calls to session.publish() are ignored until the script is done. As soon as the time is up, all messages are published in a flood.

I have corroborated this by opening the Crossbar.io router in debug mode, and it shows logs corresponding to the published messages after the time is over (not during the run as expected).

My script is long, complex and includes a combined frontend and backend for Crossbar/Twisted/Autobahn. I feel I would risk misreporting if I tried to condense and include it.

What possible reason is there for publish to not happen instantaneously?

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/5c04c639-d1d7-45ca-81cd-994dc9abe84e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/f1452e40-edc2-43cc-8e58-a2a5872984c2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “Autobahn” group.

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/d575e5dd-62e4-4622-9699-4e5f95911a55%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes