1. Local FABRIC Setup on Mac

Local FABRIC Setup on Mac

Home Forums FABRIC General Questions and Discussion Local FABRIC Setup on Mac

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3265
    Devin Lane
    Participant

      Hi,

      When trying to set up the fabric API on Mac, I can get it mostly working; it seems there are some issues with environment variables that I’m not sure how to fix. Below is an example error I am receiving:

      —————————————————————————
      AttributeError Traceback (most recent call last)
      Input In [1], in <cell line: 5>()
      1 from fabrictestbed_extensions.fablib.fablib import FablibManager as fablib_manager
      3 fablib = fablib_manager()
      —-> 5 fablib.show_config()

      File /opt/anaconda3/envs/fabric/lib/python3.9/site-packages/fabrictestbed_extensions/fablib/fablib.py:881, in FablibManager.show_config(self)
      879 def show_config(self):
      880 table = []
      –> 881 for var, val in self.get_config().items():
      882 table.append([str(var), str(val)])
      884 print(f”{tabulate(table)}”)

      File /opt/anaconda3/envs/fabric/lib/python3.9/site-packages/fabrictestbed_extensions/fablib/fablib.py:901, in FablibManager.get_config(self)
      888 def get_config(self) -> Dict[str, str]:
      889 “””
      890 Gets a dictionary mapping keywords to configured FABRIC environment
      891 variable values values.
      (…)
      894 :rtype: Dict[String, String]
      895 “””
      896 return {‘credmgr_host’: self.credmgr_host,
      897 ‘orchestrator_host’: self.orchestrator_host,
      898 ‘fabric_token’: self.fabric_token,
      899 ‘project_id’: self.project_id,
      900 ‘bastion_username’: self.bastion_username,
      –> 901 ‘bastion_key_filename’: self.bastion_key_filename,
      902 ‘bastion_public_addr’: self.bastion_public_addr,
      903 ‘bastion_passphrase’: self.bastion_passphrase,
      904 # ‘bastion_private_ipv4_addr’: self.bastion_private_ipv4_addr,
      905 # ‘slice_public_key’: self.get_default_slice_public_key(),
      906 ‘slice_public_key_file’: self.get_default_slice_public_key_file(),
      907 ‘slice_private_key_file’: self.get_default_slice_private_key_file(),
      908 ‘fabric_slice_private_key_passphrase’: self.get_default_slice_private_key_passphrase(),
      909 ‘fablib_log_file’: self.get_log_file(),
      910 ‘fablib_log_level’: self.get_log_level()
      911
      912 }

      AttributeError: ‘FablibManager’ object has no attribute ‘bastion_key_filename’

      Could someone help with this?

      Thanks.

      #3266
      Paul Ruth
      Keymaster

        I think you need to add your bastion key  to the fabric_rc file.   Refer to the “Confgure Environment” example note book.  The second to last cell shows what needs to be set on the fabric_rc file.

        https://github.com/fabric-testbed/jupyter-examples/blob/master/fabric_examples/fablib_api/configure_environment/configure_environment.ipynb

        #3267
        Devin Lane
        Participant

          Okay, I went through that and it still isn’t working. One thing I have noticed is that the environment variables aren’t persistent; I restarted my computer and the exported variables were no longer present. Could this have something to do with Mac using zsh?

          #3271
          Paul Ruth
          Keymaster

            You can make those env vars persistent in any way you can on your machine.  The important part is that they are set before you run your FABlib application OR if you are using JupyterLab on  your machine, you will need have the vars set before you start JupyterLab.

            On the FABRIC JupyterHub, we skip this issue by having the application read the fabric_rc file and set the vars.  You might want to do this as well.  The easiest way to do this is to put all your FABRIC config files in the same place as on the JupyterHub (i.e. ${HOME}/work/fabric_config/).  You can also set a different location whey you create a FABlib manager.

            #3291
            Devin Lane
            Participant

              As an update, I found a pretty good solution.

              1. Update the configure_environment jupyter notebook to match the file structure of your local machine.
              2. Run the notebook.
              3. Shut down Jupyter server.
              4. ‘source’ the fabric_rc file created from the configure_environment notebook:
                1. source <path_to_fabric_rc>
              5. Start Jupyter server.

              That should work. Please respond to this post if something seems wrong or if anyone else is having this issue.

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