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

add hooks to surround the dj execution in the worker #1017

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wshihadeh
Copy link

Add hooks to surround the DJ execution in the worker. This will allow us to configure the environment for each individual Dj. A good use case, when we would like to tag the logs of each Dj bases on an attribute of the DJ.

@albus522
Copy link
Member

albus522 commented Feb 7, 2018

I think you are looking for the perform callback that already exists

@albus522 albus522 closed this Feb 7, 2018
@wshihadeh
Copy link
Author

No , I want to prepare the logger for each of the individuals djs , even before the perform callback. so we have the same tag for all log lines, even the ones generated by the worker. and that is why I added it at the beginning of the run method. with this change the below log line will be also affected with the tag.

     job_say job, 'RUNNING'

@albus522
Copy link
Member

albus522 commented Feb 7, 2018

The perform callback wraps the run call in which you are adding your hooks https://github.com/collectiveidea/delayed_job/pull/1017/files#diff-70ead5838f9d70eb6391b0b682b035fdL312

@wshihadeh
Copy link
Author

But I cant define this in my custom job, or at least it is not working as expected.
As I can see you are talking about the hook for the life cycle, however, i would like to add it to the custom job hooks.

@albus522 albus522 reopened this Feb 8, 2018
@albus522
Copy link
Member

albus522 commented Feb 8, 2018

Self note: We probably need to re-investigate having the lifecycle callbacks call any appropriate job hooks. Having 2 disjointed setups is not helping our maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants