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

[APERO_REQUEST] Problem with sending emails when request running + new requests added #239

Open
njcuk9999 opened this issue Apr 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@njcuk9999
Copy link
Owner

njcuk9999 commented Apr 16, 2024

People got links that did not work. Then got second email with a link that worked.

In logs apero_request started looking at 25 jobs, then jumped to 27 jobs, then back to 25 jobs?

Seems that the 2 people who got bad links were the 2 jobs that were "added"?

Problem with two apero_request codes running at same time?

@njcuk9999 njcuk9999 added the bug Something isn't working label Apr 16, 2024
@njcuk9999 njcuk9999 self-assigned this Apr 16, 2024
@njcuk9999
Copy link
Owner Author

Seem to be this piece of code that is the problem

def main():
    """
    Wrapper around main code to catch errors (and exit nicely)
    i.e. deal with the lock file
    :return:
    """
    # lets lock (or not run if locked)
    not_running = general.lock(stop=True)
    # load params
    params = misc.load_params()
    # if running then we exit
    if not not_running:
        misc.log_msg(params, 'Request already running - exiting')
    # try to run main code
    try:
        __main__(params)
        # unlock the code
        general.unlock()
    except Exception as e:
        # unlock the code
        general.unlock()
        # raise exception
        raise e

Need to exit inside the if statement where we print "Request already running" otherwise code will just run as normal after printing this - thus getting two apero_requests running at the same time.

def main():
    """
    Wrapper around main code to catch errors (and exit nicely)
    i.e. deal with the lock file
    :return:
    """
    # lets lock (or not run if locked)
    not_running = general.lock(stop=True)
    # load params
    params = misc.load_params()
    # if running then we exit
    if not not_running:
        misc.log_msg(params, 'Request already running - exiting')
        return
    # try to run main code
    try:
        __main__(params)
        # unlock the code
        general.unlock()
    except Exception as e:
        # unlock the code
        general.unlock()
        # raise exception
        raise e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant