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

Refactor modifier #104

Draft
wants to merge 59 commits into
base: python-cli-refactor
Choose a base branch
from
Draft

Refactor modifier #104

wants to merge 59 commits into from

Conversation

ebensonm
Copy link

Refactor of modifier functionality, the queueing/enqueueing seems to be running, though I have not done any hard test using rq-dashboard, because I have not figure out how to do it on the lab machines.

ebensonm and others added 30 commits January 18, 2021 10:38
pull down most recent changes from python-cli-refactor
@bjschoenfeld

This comment has been minimized.

experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
experimenter/query.py Outdated Show resolved Hide resolved
@bjschoenfeld
Copy link
Member

query.py needs more work. It is hard to read and understand what is happening.

setup.py Outdated Show resolved Hide resolved
Comment on lines +96 to +101
if (empty_failed_queue is True):
empty_failed(queue_name=queue_name)
else:
queue = get_queue(queue_name)
queue.empty()
print(_EMPTIED_MESSAGE.format(queue_name))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on your experience, was it helpful to just empty one, not both at the same time?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, it was helpful to just empty one at a time. This might have just been a developmental thing, and it might not be useful when things are up and running. But I do not think it would be too harmful to keep it around.

Comment on lines +43 to +63
def get_failed_job(queue_name:str = _DEFAULT_QUEUE, job_num:int = 0):
#pass name and connection
reg = rq.registry.FailedJobRegistry(name = queue_name, connection = get_connection())
job_ids = reg.get_job_ids()
if (len(job_ids)<=0):
return "None", reg
job_id = job_ids[0]
return job_id, reg


def save_failed_job(queue_name:str = _DEFAULT_QUEUE, job_num:int = 0):
if (queue_name is None):
queue_name = _DEFAULT_QUEUE
job_id, failed_queue = get_failed_job()
job = rq.job.Job.fetch(job_id, connection=get_connection())
with open (os.path.join('/data',"failed_job_{}.txt".format(job_num)), 'w') as job_file:
job_file.write(job.exc_info)
#remove the job
failed_queue.remove(job_id, delete_job=True)
print(_SAVE_FAILED_MESSAGE.format(os.path.join('/data',
"failed_job_{}.txt".format(job_num))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two functions look like they have not been run. Did you use past versions of it? How was it helpful?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first function, I use for returning the failed queue so that I can empty it, and also I return a single job. The returning of the single job is used in the second function, which then saves the failure output to a file in the '/data' directory. This is for remote development and debugging. We can look at the reason why a task failed without having to do some kind of dashboard thing (it will be saved to a file). I use that one with the queue --save-failed command. The first function is used in quite a few places on the queue.py file. It returns the failed queue, which is what I use it for most often.

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.

3 participants