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

Today's sync bug #970

Closed
ewels opened this issue Mar 25, 2021 · 0 comments
Closed

Today's sync bug #970

ewels opened this issue Mar 25, 2021 · 0 comments
Labels
bug Something isn't working high-priority

Comments

@ewels
Copy link
Member

ewels commented Mar 25, 2021

sync_log_dualrnaseq.zip

$   nf-core --log-file sync_log_dualrnaseq.txt sync nf-core/dualrnaseq --from-branch dev --pull-request --username nf-core-bot --repository nf-core/dualrnaseq

                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'

    nf-core/tools version 1.13.3



INFO     Pipeline directory:                                          sync.py:86
         /home/runner/work/tools/tools/nf-core/dualrnaseq                       
INFO     Using branch 'dev' to fetch workflow variables               sync.py:88
INFO     Will attempt to automatically create a pull request          sync.py:90
INFO     Original pipeline repository branch is 'dev'                sync.py:142
INFO     Deleting all files in 'TEMPLATE' branch                     sync.py:198
INFO     Making a new template pipeline using pipeline variables     sync.py:216
INFO     Committed changes to 'TEMPLATE' branch                      sync.py:242
INFO     Pushing TEMPLATE branch to remote: 'dualrnaseq'             sync.py:252
INFO     Checking out merge base branch                              sync.py:280
         'nf-core-template-merge-1.13.3'                                        
INFO     Pushing 'nf-core-template-merge-1.13.3' branch to remote    sync.py:288
INFO     Submitting a pull request via the GitHub API                sync.py:301
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /opt/hostedtoolcache/Python/3.8.8/x64/bin/nf-core:8 in <module>              │
│                                                                              │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])     │
│ ❱ 8 │   sys.exit(run_nf_core())                                              │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/nf_core/__ │
│ main__.py:57 in run_nf_core                                                  │
│                                                                              │
│    56 │   # Lanch the click cli                                              │
│ ❱  57 │   nf_core_cli()                                                      │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/click/core │
│ .py:829 in __call__                                                          │
│                                                                              │
│    828 │   │   """Alias for :meth:`main`."""                                 │
│ ❱  829 │   │   return self.main(*args, **kwargs)                             │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/click/core │
│ .py:782 in main                                                              │
│                                                                              │
│    781 │   │   │   │   with self.make_context(prog_name, args, **extra) as c │
│ ❱  782 │   │   │   │   │   rv = self.invoke(ctx)                             │
│    783 │   │   │   │   │   if not standalone_mode:                           │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/click/core │
│ .py:1259 in invoke                                                           │
│                                                                              │
│   1258 │   │   │   │   with sub_ctx:                                         │
│ ❱ 1259 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/click/core │
│ .py:1066 in invoke                                                           │
│                                                                              │
│   1065 │   │   if self.callback is not None:                                 │
│ ❱ 1066 │   │   │   return ctx.invoke(self.callback, **ctx.params)            │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/click/core │
│ .py:610 in invoke                                                            │
│                                                                              │
│    609 │   │   │   with ctx:                                                 │
│ ❱  610 │   │   │   │   return callback(*args, **kwargs)                      │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/nf_core/__ │
│ main__.py:664 in sync                                                        │
│                                                                              │
│   663 │   try:                                                               │
│ ❱ 664 │   │   sync_obj.sync()                                                │
│   665 │   except (nf_core.sync.SyncException, nf_core.sync.PullRequestExcept │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/nf_core/sy │
│ nc.py:113 in sync                                                            │
│                                                                              │
│   112 │   │   │   │   self.push_merge_branch()                               │
│ ❱ 113 │   │   │   │   self.make_pull_request()                               │
│   114 │   │   │   │   self.close_open_template_merge_prs()                   │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/site-packages/nf_core/sy │
│ nc.py:349 in make_pull_request                                               │
│                                                                              │
│   348 │   │   │   │   log.debug(f"GitHub API PR failed with 403              │
│       error:\n{returned_data_prettyprint}\n\n{r.headers}")                   │
│ ❱ 349 │   │   │   │   wait_time = float(re.sub("[^0-9]", "", r.headers.get(" │
│       30)))                                                                  │
│   350 │   │   │   │   log.warning(f"Got 403 code - probably the abuse protec │
│       after {wait_time} seconds..")                                          │
│                                                                              │
│ /opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/re.py:210 in sub         │
│                                                                              │
│   209 │   a replacement string to be used."""                                │
│ ❱ 210 │   return _compile(pattern, flags).sub(repl, string, count)           │
╰──────────────────────────────────────────────────────────────────────────────╯
TypeError: expected string or bytes-like object
Error: Process completed with exit code 1.

Verbose log:

[2021-03-25 18:17:33,223] nf_core.sync         [INFO   ]  Submitting a pull request via the GitHub API
[2021-03-25 18:17:33,577] nf_core.sync         [DEBUG  ]  GitHub API PR failed with 403 error:
{
    "message": "You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.",
    "documentation_url": "https://docs.github.com/overview/resources-in-the-rest-api#abuse-rate-limits"
}

{'Server': 'github.com', 'Date': 'Thu, 25 Mar 2021 18:17:33 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'X-OAuth-Scopes': 'repo, workflow', 'X-Accepted-OAuth-Scopes': '', 'X-GitHub-Media-Type': 'github.v3; format=json', 'X-RateLimit-Limit': '5000', 'X-RateLimit-Remaining': '4513', 'X-RateLimit-Reset': '1616696995', 'X-RateLimit-Used': '487', 'Access-Control-Expose-Headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '0', 'Referrer-Policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', 'Content-Security-Policy': "default-src 'none'", 'Vary': 'Accept-Encoding, Accept, X-Requested-With', 'Content-Encoding': 'gzip', 'X-GitHub-Request-Id': '0480:6787:124C0:36C3E:605CD3BD'}

So looks like I messed up the new regex code in the abuse mechanism loop. I probably should have written a pytest for it.. 🙄

@ewels ewels added bug Something isn't working high-priority labels Mar 25, 2021
ewels added a commit to ewels/nf-core-tools that referenced this issue Mar 26, 2021
* Fixes main bug that the default value for the Retry-After header was an int and not a str
* Make the default wait random, between 10 - 60 seconds
* Some tweaks, print the headers in more log messages, make them prettier.

Fixes nf-core#970
@ewels ewels closed this as completed Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority
Projects
None yet
Development

No branches or pull requests

1 participant