1. How to use long-lived tokens in experiments

How to use long-lived tokens in experiments

Home Forums FABRIC General Questions and Discussion How to use long-lived tokens in experiments

Tagged: ,

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #7055
    Nishanth Shyamkumar
    Participant

      When I try to use my generated long-lived token in an experiment, it fails with an Exception.

      Digging into the Fabric source code, in slice_manager.py, there is a check for refresh_tokens, however the long lived token does not contain this json field, which is why it always fails. The __load_tokens function is pasted below:

      def __load_tokens(self, refresh: bool = True):
              “””
              Load Fabric Tokens from the tokens.json if it exists
              Otherwise, this is the first attempt, create the tokens and save them
              @note this function is invoked when reloading the tokens to ensure tokens
              from the token file are read instead of the local variables
              “””
              # Load the tokens from the JSON
              if os.path.exists(self.token_location):
                  print(“token path exists\n”)
                  with open(self.token_location, ‘r’) as stream:
                      self.tokens = json.loads(stream.read())
                      print(f”self.tokens is {self.tokens}”)
                  refresh_token = self.get_refresh_token()
              else:
                  # First time login, use environment variable to load the tokens
                  refresh_token = os.environ.get(Constants.CILOGON_REFRESH_TOKEN)
              # Renew the tokens to ensure any project_id changes are taken into account
              if refresh and self.auto_refresh:
                  if refresh_token is None:
                      raise SliceManagerException(f”Unable to refresh tokens: no refresh token found!”)
                  self.refresh_tokens(refresh_token=refresh_token)

      How can I use the long lived token without the Fablib code raising exceptions ?

      #7057
      Komal Thareja
      Participant

        Hi Nishanth,

        This issue has been fixed for a while now but is only available in Beyond Bleeding Edge Container.

        Could you please use that? This should be available in the pypi with the next release.

        Thanks,

        Komal

        #7093
        Nishanth Shyamkumar
        Participant

          Hi Komal,

          I am using fablib from within a Python program. Can you let me know which branch of fabrictestbed-extensions should I use to have this updated change? Is it the main branch? Or branch 1.7?

          pip install git+https://github.com/fabric-testbed/fabrictestbed-extensions@main

          #7098
          Komal Thareja
          Moderator

            Please install from the main branch via the command you shared.

            Thanks,

            Komal

            #7125
            Nishanth Shyamkumar
            Participant

              Hi Komal,

              Looking at the source code, the required change in slice_manager.py is not present on the main branch. It is available in the other branches: adv-res, llt and 1.7
              Should I use one of these branches to use the long lived tokens?
              Essentially:
              pip install git+https://github.com/fabric-testbed/fabrictestbed@1.7

              #7164
              Komal Thareja
              Participant

                Hi Nishant,

                Installing fablib from main branch should work. It is using the fabrictestbed==1.5.9 dependency which has the fix.

                fabrictestbed==1.5.9 is built from llt branch. I will work on merging this branch to main as well.

                Thanks,

                Koma

                #7207
                Nishanth Shyamkumar
                Participant

                  Hi Komal,

                  I tried this and it still does not work. Here are the fabric packages in my environment:

                  [code]

                  pip list | grep fab │
                  fabric-credmgr-client 1.6.1 │
                  fabric_fim 1.6.1 │
                  fabric_fss_utils 1.5.1 │
                  fabric-orchestrator-client 1.6.1 │
                  fabrictestbed 1.6.9 │
                  fabrictestbed-extensions 1.6.5

                  [/code]

                  The fabrictestbed is at 1.6.9, yet the slice_manager.py and specifically the __load_tokens still has the refresh token Exception check.

                  #7222
                  Komal Thareja
                  Participant

                    We are deploying 1.7 next week which would contain a fix for this issue. Apologies for the inconvenince!

                    Thanks,

                    Komal

                    #7280
                    Komal Thareja
                    Participant

                      Hi Nishanth,

                      The fix for this issue is now available with fabrictestbed-extensions==1.7.2

                      Thanks,

                      Komal

                      #7283
                      Nishanth Shyamkumar
                      Participant

                        Thanks Komal, I tested it and it is working without any issues after the update.

                      Viewing 10 posts - 1 through 10 (of 10 total)
                      • You must be logged in to reply to this topic.