Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python example does not work #426

Open
glensc opened this Issue Jun 20, 2017 · 10 comments

Comments

Projects
None yet
5 participants
@glensc
Copy link
Contributor

glensc commented Jun 20, 2017

http://www.fedmsg.com/en/latest/#publishing-messages-with-python

the example given on homepage does not work (0.18.3):

$ cat publish.py
#!/usr/bin/python

import fedmsg
fedmsg.publish(topic='testing', modname='test', msg={
    'test': "Hello World",
})
$ ./publish.py
/usr/share/python2.7/site-packages/fedmsg/core.py:159: UserWarning: fedmsg is not configured to send any zmq messages for name '__main__.wintersunset'
Traceback (most recent call last):
  File "./publish.py", line 5, in <module>
    'test': "Hello World",
  File "/usr/share/python2.7/site-packages/fedmsg/__init__.py", line 79, in _wrapper
  File "/usr/share/python2.7/site-packages/fedmsg/__init__.py", line 94, in publish
  File "/usr/share/python2.7/site-packages/fedmsg/core.py", line 320, in publish
AttributeError: 'FedMsgContext' object has no attribute 'publisher'
$ 

however i had older test.py laying around that does work:

$ cat test.py 
#!/usr/bin/python

import fedmsg

# until this is in place, add name="relay_inbound": http://paste.fedoraproject.org/155599/74653371/

fedmsg.publish(topic='testing', modname='test', active=True, name="relay_inbound", msg={
        'test': "Hello World",
})
@jeremycline

This comment has been minimized.

Copy link
Member

jeremycline commented Jun 20, 2017

Hmm. I have a suspicion that this is a configuration/services problem of some kind. I tried both snippets and neither one worked for me. I'm going to label this as a docs issue until I can investigate further, but it might be a regression of some kind, as well. Either way, the docs need some attention.

@jeremycline jeremycline added the docs label Jun 20, 2017

@glensc

This comment has been minimized.

Copy link
Contributor Author

glensc commented Jun 20, 2017

either way, AttributeError: 'FedMsgContext' object has no attribute 'publisher' is ugly message to show, meaning error handling is not even in place. this should be handled and proper error be thrown. perhaps with a hint what configuration is missing. or some better defaults invented.

@jeremycline

This comment has been minimized.

Copy link
Member

jeremycline commented Jun 20, 2017

I definitely agree.

@reCursedd

This comment has been minimized.

Copy link

reCursedd commented Apr 1, 2018

Hello @jeremycline , @glensc
I am new to this and I was following the docs when I faced the same issue as @glensc . I think the problem lies in core.py and a try case needs to be added.
The current doc example doesn't work because active is by default 'False' in config.py and it has to be overridden as 'True' from either publish() or .config dict as we are trying to publish through a relay.
Please let me know what you think, I am just trying to learn fedmsg usage.

@jeremycline

This comment has been minimized.

Copy link
Member

jeremycline commented Apr 4, 2018

@reCursedd that sounds reasonable. Another option would be to add something in the endpoints config.

@Algogator

This comment has been minimized.

Copy link

Algogator commented Jun 11, 2018

Any updates on this?

@jeremycline

This comment has been minimized.

Copy link
Member

jeremycline commented Jun 11, 2018

As far as I know it's still present. I don't think it's worth fixing at this point since we're probably going to stop using fedmsg.

@reCursedd

This comment has been minimized.

Copy link

reCursedd commented Jun 11, 2018

@jwflory

This comment has been minimized.

Copy link
Member

jwflory commented Feb 23, 2019

@jeremycline Could you point to some fedora-messaging migration resources for the benefit of those who come across this issue in the future?

There are a few GSoC / Outreachy projects blocked by this issue. I think there is confusion about the transition from fedmsg to fedora-messaging (that, or I am confused too). It will probably help to clarify how to migrate over.

@jeremycline

This comment has been minimized.

Copy link
Member

jeremycline commented Feb 25, 2019

@jwflory sure. And if anyone comes across this issue in the future, I'm happy to answer whatever questions you have.

The user guide and API guide at https://fedora-messaging.readthedocs.io/en/stable/ is a good place to start, and there's a section on converting from fedmsg to fedora-messaging: https://fedora-messaging.readthedocs.io/en/stable/tutorial/index.html.

One thing that adds a bit of confusion at the moment is that Fedora's broker cluster is inside the VPN and not accessible over the Internet. What still is currently accessible is the ZeroMQ PUB socket which is what fedmsg uses. It's on my backlog to address this, I just have other fires to tend at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.