DiamondLightSource / httomo

High-throughput tomography pipeline
https://diamondlightsource.github.io/httomo/
BSD 3-Clause "New" or "Revised" License
4 stars 3 forks source link

Fix expired auth token for conda package upload #339

Closed yousefmoazzam closed 1 week ago

yousefmoazzam commented 1 month ago

There's maybe other things wrong with the conda package build (since it's been a while since we've used it), but one issue is that the token used for authenticating the upload request of the conda package tot he httomo channel appears to have expired, see this github action run failure https://github.com/DiamondLightSource/httomo/actions/runs/9172461994/job/25219007843

A snippet showing the main error is given below:

Error:  
Traceback (most recent call last):
  File "/usr/share/miniconda/bin/anaconda", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/scripts/cli.py", line 257, in main
    binstar_main(commands, args, exit_)
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/scripts/cli.py", line 206, in binstar_main
    return arguments.main(arguments)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/commands/upload.py", line 56, in main
    _ = uploader.username
        ^^^^^^^^^^^^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/commands/upload.py", line 363, in username
    username = self.api.user()['login']
               ^^^^^^^^^^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/__init__.py", line 247, in user
    self._check_response(res)
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/__init__.py", line [229](https://github.com/DiamondLightSource/httomo/actions/runs/9172461994/job/25219007843#step:6:230), in _check_response
    raise ErrCls(msg, res.status_code)
binstar_client.errors.Unauthorized: ('Authentication token has expired', 401)
dkazanc commented 1 week ago

I was able to build the package here, however I cannot find such error. The package wasn't uploaded though. So the issue could be still there?

yousefmoazzam commented 1 week ago

Hmm, from the end of the output of the step "Build and upload the package to httomo conda cloud" in the job you linked, it doesn't appear to run any code that suggests it's trying to upload the built packages.

In the job linked in the original post, the end of that step had the summary of the built packages:

# Automatic uploading is disabled
# If you want to upload package(s) to anaconda.org later, type:

# To have conda build upload to anaconda.org automatically, use
# conda config --set anaconda_upload yes
anaconda upload \
    /home/runner/conda-bld/linux-64/httomo-2.0.0rc1-py310_0.tar.bz2 \
    /home/runner/conda-bld/linux-64/httomo-2.0.0rc1-py39_0.tar.bz2
anaconda_upload is not set.  Not uploading wheels: []

INFO :: The inputs making up the hashes for the built packages are as follows:
{
  "httomo-2.0.0rc1-py310_0.tar.bz2": {
    "recipe": {}
  },
  "httomo-2.0.0rc1-py39_0.tar.bz2": {
    "recipe": {}
  }
}

####################################################################################
Resource usage summary:

Total time: 0:02:00.4
CPU usage: sys=0:00:00.0, user=0:00:00.0
Maximum memory usage observed: 16.4M
Total disk usage observed (not including envs): 541.2K

followed immediately by an upload error (presumably relating to the code in conda_upload.sh):

/home/runner/conda-bld/linux-64/httomo-2.0.0rc1-py39_0.tar.bz2
Using Anaconda API: https://api.anaconda.org/
[DEBUG] Using token from command line args
Error:  
Traceback (most recent call last):
  File "/usr/share/miniconda/bin/anaconda", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/scripts/cli.py", line 257, in main
    binstar_main(commands, args, exit_)
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/scripts/cli.py", line 206, in binstar_main
    return arguments.main(arguments)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/commands/upload.py", line 56, in main
    _ = uploader.username
        ^^^^^^^^^^^^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/commands/upload.py", line 363, in username
    username = self.api.user()['login']
               ^^^^^^^^^^^^^^^
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/__init__.py", line 247, in user
    self._check_response(res)
  File "/usr/share/miniconda/lib/python3.12/site-packages/binstar_client/__init__.py", line [229](https://github.com/DiamondLightSource/httomo/actions/runs/9172461994/job/25219007843#step:6:230), in _check_response
    raise ErrCls(msg, res.status_code)
binstar_client.errors.Unauthorized: ('Authentication token has expired', 401)

However, the job you posted appears to give the summary and nothing more (suggesting that it's not trying to upload the built packages for some reason):

# Automatic uploading is disabled
# If you want to upload package(s) to anaconda.org later, type:

# To have conda build upload to anaconda.org automatically, use
# conda config --set anaconda_upload yes
anaconda upload \
    /home/runner/conda-bld/linux-64/httomo-2.0.0rc1-py310_openmpi_regular.tar.bz2 \
    /home/runner/conda-bld/linux-64/httomo-2.0.0rc1-py39_openmpi_regular.tar.bz2 \
    /home/runner/conda-bld/linux-64/httomo-2.0.0rc1-py310_openmpi_external.tar.bz2 \
    /home/runner/conda-bld/linux-64/httomo-2.0.0rc1-py39_openmpi_external.tar.bz2
anaconda_upload is not set.  Not uploading wheels: []

INFO :: The inputs making up the hashes for the built packages are as follows:
{
  "httomo-2.0.0rc1-py310_openmpi_external.tar.bz2": {
    "recipe": {
      "openmpi_build": "external",
      "target_platform": "linux-64"
    }
  },
  "httomo-2.0.0rc1-py310_openmpi_regular.tar.bz2": {
    "recipe": {
      "openmpi_build": "regular",
      "target_platform": "linux-64"
    }
  },
  "httomo-2.0.0rc1-py39_openmpi_external.tar.bz2": {
    "recipe": {
      "openmpi_build": "external",
      "target_platform": "linux-64"
    }
  },
  "httomo-2.0.0rc1-py39_openmpi_regular.tar.bz2": {
    "recipe": {
      "openmpi_build": "regular",
      "target_platform": "linux-64"
    }
  }
}

####################################################################################
Resource usage summary:

Total time: 0:07:14.8
CPU usage: sys=0:00:00.2, user=0:00:01.9
Maximum memory usage observed: 183.6M
Total disk usage observed (not including envs): 1.1M
dkazanc commented 1 week ago

thanks, I think I know the possible reason. $CONDA_BLD_PATH/$OS didn't find the packages as I set OS=noarch, however, the package was built as "target_platform": "linux-64". Which is probably correct as we do not know if we can support windows so far.

dkazanc commented 1 week ago

Yep, that was it. We've got the packages now: https://anaconda.org/httomo/httomo/files