Closed villanuevawill closed 6 years ago
This issue now has a funding of 0.17 ETH (91.41 USD @ $537.71/ETH) attached to it.
Work has been started on the 0.17 ETH (87.37 USD @ $513.94/ETH) funding by:
Please work together and coordinate delivery of the issue scope. Gitcoin doesn't know enough about everyones skillsets / free time to say who should work on what, but we trust that the community is smart and well-intentioned enough to work together. As a general rule; if you start work first, youll be at the top of the above list ^^, and should have 'dibs' as long as you follow through.
On the above list? Please leave a comment to let the funder and the other parties involved what you're working, with respect to this issue and your plans to resolve it. If you don't leave a comment, the funder may expire your submission at their discretion.
@villanuevawill i propose use decorators that accept a format like "Bounty Title, ID, fulfillment_id" and provides the bounty object to each method in std_bounties client. After the method is executed, the notification to slack is sended. In thar way reduce 1:1 modification relation between slack and the client. what do you think?
@villanuevawill Where do you think is the best directory for 'slack_client.py' to live? EDIT: was thinking 'bounties_api/std_bounties/slack_client.py' looks good, yah?
@zoek1 I like the idea overall, however we run into a couple issues with this approach. 1 issue is that in some of these we need the fulfillment details. Another issue is that for issue_bounty, the bounty does not exist yet. For fulfill_bounty, the fulfillment object does not exist yet either.
The other concern I would have is that I want to keep the functions independent from the client.py functions. In the case we ever have to work on speeding up our realtime syncing processes, we may want to move the slack client to a listening service/separate job. Also, not all the notifications require acquiring the full bounty model.
I do like the concern of the 1:1 modification relation. I was thinking that we could do some refactoring where there is a generic client class for each event that calls the function on both. In this case, the client.py functions wouldn't need to know about the slack client functions.
Thoughts?
@zoek1 and @ryansdavis - Since @zoek1 dibbed this first, if he still wants to move forward on this task, then I would say he would get priority. If you both want to work together, then that is fine as well, but typically first worker will handle this. @zoek1 let me know if you plan on moving forward on this.
Of course @villanuevawill, i'm working on this right now! I hope make the pull request tomorrow.
also @zoek1 - where in Mexico do you live? I'm in Mexico City for the next 2 weeks.
@villanuevawill i was thinking about your concerns, and it can easily achieved in a "monadic" way.
>>
that pass the object retrieved in case to exists or terminates the execution.
1.2 If is required that the object doesn't exists, we use !>>
that return an empty Bounty or Fulfillment object in case doesn't exists or terminates the execution in case that exists the objectupdater
function, that return the object updated, in case the update fails, it raise an exception or returns None so the execution stops.filter
function that narrow the fields and return a dict with the required keys, if the fields doens't exist the execution stopsget_bounty(bounty_id)
!>> bounty_client.fulfill_bounty(fulfillment_id, ...)
>> narrow(['title', 'id', 'token', 'usd_price', ...)
>> slack_enqueue_or_notification
This functional way is more appropriate to async functionality or to move the slack notification system a listening service/separate job.
Obviosly we'll be using a pythonic implementation, this code is just an example.
i'll be in mexico city this week also.
@zoek1 I like the proposal. Go for it. Only thing is it would be cool if each of the operations gets abstracted to a parent client that does this. That way the code is clean and just has one call in each event if statement. 👍 go for it.
Also, send me a dm on the gitcoin community slack - bountiesWill since you're in town!
@villanuevawill @zoek1 Sounds like ya'll got a handle on this :+1: :+1:
@villanuevawill all events are processed correctly in this PR #12. I just need to clean the code and write pending tests. Can you give me feedback about the PR, please?
Work for 0.17 ETH (70.57 USD @ $415.12/ETH) has been submitted by:
Submitters, please leave a comment to let the funder (and the other parties involved) that you've submitted you work. If you don't leave a comment, the funder may expire your submission at their discretion.
The funding of 0.17 ETH (87.37 USD @ $513.94/ETH) attached to this issue has been approved & issued to @zoek1.
Great work here.
Description
Currently, we have a notification channel in slack that lets us know when contract events have occurred. In its current state, it only sends the following info to the slack channel:
'Event {} passed for bounty {}'.format(event, str(bounty_id))
or an example:Event BountyFulfilled passed for bounty 162
We would like to make this slack channel public, and would like to provide more information. Gitcoin's notification channel provides a great example of detailed messages.
In our iteration, we'd actually like the std_bounties client to call the slack function at the end of each of the functions. Keep in mind, the std_bounties client is called by the long-running job bounties_subscriber. A file should be added called slack_clienty.py with the same functions as the std_bounties client and work as a mirror.
We want the following info posted for each event:
Also, each should give a link to the issue on the bounty network: beta.bounties.network
Once work has been started, we will give access to the appropriate slack channels. Once completed, the channels will be public.
Pep8 compliance required
Definition of Done
Reviewers
Review Requirements