NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Install azure-cli.

    In Ubuntu it can be installed using the following command:

    Code Block
     sudo apt-get install nodejs-legacy
     sudo apt-get install npm
     sudo npm install -g azure-cli

     

    To login run the following command:

    azure login

    Copy the code offered to you, above, and open a browser to http://aka.ms/devicelogin. Enter the code, and then you are prompted to enter the username and password for the identity you want to use. When that process completes, the command shell completes the log in process.

  2. From command line azure sb namespace create <name> <location> where <location> can be "East US"

  3. Log on to the Azure Portal.
  4. In the left pane, click Service Bus.
  5. Select the service bus you just created.
  6. At the top of the screen click Queues.
  7. Click Create a new queue.
  8. Click Quick Create and create a new queue named "compute".
  9. Click Create A New Queue.
  10. At the bottom of the screen, click New, and create another queue named "response".
  11. In the left pane, click Service Bus.
  12. At the bottom of the page, click Connection Information.
  13. Copy the following connection information:
    • Namespace name
    • Default issuer
    • Default key

...

  1. Open your local configuration file (local.py). If there is no local.py, save a copy of local_sample.py named local.py in the same directory.
  2. In the Azure storage section, enter your Azure account details:

    Code Block
    DEFAULT_FILE_STORAGE = 'codalab.azure_storage.AzureStorage'
    AZURE_ACCOUNT_NAME = "<enter name>"
    AZURE_ACCOUNT_KEY = '<enter key>'
    AZURE_CONTAINER = '<enter container name>'
    
    PRIVATE_FILE_STORAGE = 'codalab.azure_storage.AzureStorage'
    PRIVATE_AZURE_ACCOUNT_NAME = "<enter name>"
    PRIVATE_AZURE_ACCOUNT_KEY = "<enter key>"
    PRIVATE_AZURE_CONTAINER = "<enter container name>"
    
    BUNDLE_AZURE_CONTAINER = "<enter the name of your bundle container>"
    BUNDLE_AZURE_ACCOUNT_NAME = PRIVATE_AZURE_ACCOUNT_NAME
    BUNDLE_AZURE_ACCOUNT_KEY = PRIVATE_AZURE_ACCOUNT_KEY
    
    
  3. In the Service Bus section, enter your service bus connection information:

    Code Block
    SBS_NAMESPACE = '<enter the name of your service bus>'
    SBS_ISSUER = 'owner'
    SBS_ACCOUNT_KEY = '<enter value for 'default key'>'
    Note
    titleImportant

    Do not change the values for DEFAULT_FILE_STORAGE and PRIVATE_FILE_STORAGE, as these parameters contain the name of the Python class which implements the Azure storage back-end for Django.

  4. In the DATABASES section, enter the configuration settings for the database you want to use.

    SQL Server*

    Code Block
    DATABASES = {
        'default': {
            'ENGINE': 'sql_server.pyodbc',
            'NAME': 'somename',
            # Leaver user and password blank to use integrated security
            'USER': '',
            'PASSWORD': '',
            'HOST': '(localdb)\\v11.0', 
            'PORT': '',
            'OPTIONS': {
               'driver': 'SQL Server Native Client 11.0',
            }
        }

    MySQL

    Code Block
    DATABASES = {
        'default': {
            'ENGINE':  'django.db.backends.mysql',
            'NAME': 'MySQL_DevDB',
            'USER': 'someuser',
            'PASSWORD': 'somepassword',
            'HOST': 'someserver', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
            'PORT': '',           # Set to empty string for default.
        }

...

  1. Run the following commands to initialize the database.

    Windows

    Code Block
    cd codalab
    python manage.py validate
    python manage.py syncdb --migrate
    python scripts\initialize.py

     

    Linux

    Code Block
    cd codalab
    python manage.py validate
    python manage.py syncdb --migrate
    python scripts/initialize.py
  2. Run tests to verify that everything is working.

    python manage.py test

  3. Optional: Populate the site with some sample data.

    Windows

    Code Block
    python scripts\users.py
    python scripts\competitions.py

    Linux

    Code Block
    python scripts/users.py
    python scripts/competitions.py

...

  1. Begin by enabling the Worksheet feature in your web site. In your Django settings (local.py), add:

    Code Block
    PREVIEW_WORKSHEETS = True
    BUNDLE_SERVICE_URL = "http://localhost:2800"
    # CODE_PATH points to local source code for bundles repo. Path is relative to this file.
    BUNDLE_SERVICE_CODE_PATH = "..\\..\\..\\..\\codalab-cli"
    if len(BUNDLE_SERVICE_CODE_PATH) > 0:
        sys.path.append(join(dirname(abspath(__file__)), BUNDLE_SERVICE_CODE_PATH))
        codalab.__path__ = extend_path(codalab.__path__, codalab.__name__)

    These additional elements say to enable Worksheets using the bundle service running at the given URL (in the next steps we'll cover how to start the bundle service with the cl server command). Finally, the code in apps\web\bundles.py will need to import modules from the codalab-cli project. Therefore, we extend the Python path by pointing to the CLI code on your machine. If you have repos codalab and codalab-cli checked in folders which are siblings, the relative BUNDLE_SERVICE_CODE_PATH given above should work for your setup.

    The Django web site is a client of the bundle service. For example, to get a list of worksheets, the Django web site makes a call to the list_worksheets API exposed by the bundle service. However, to handle authorization, the bundle service must be able to make calls back to the web site, which hosts the OAuth server. As a result, the bundle service is a trusted OAuth client of the web site. To

...

  1. set up this trusted relationship:a.

  2. Create a user on the web site. Typically, I we call this user codalab. Treat it as an admin user even though the CodaLab site doesn't really have admin roles today.
  3. b. Activate your virtual environment and run the script: codalab\codalab\scripts\sample_cl_server_config.py. The script will generate an output of the form:
Code Block
Checking that confidential client exists for user codalab

  Client already exists.

  Add the following server block to your CLI config:

  "server": {
      "auth": {
          "address": "http://localhost:8000",
          "app_id": "5m <snip> Le",
          "app_key": "_b <snip> !_",
          "class": "OAuthHandler"
      },
      "class": "SQLiteModel",
      "host": "localhost",
      "port": 2800
  }
    1. Take the "server" block in the output and insert it into your CLI config file (.codalab\config.json in your home directory). Since the values for app_id and app_key can be long, make sure to remove any line breaks that resulted from copying from the command prompt.
  1. c.
    1. Run the Django web site. Make sure it uses port 8000. Note for Visual Studio users: with the latest Python Tools for Visual Studio, you can set the port number in the Debug tab of the project properties.
  2. d.
    1. Activate your virtual environment and then run the bundle service: cl server.

Start the Web Server

  1. Use the following command to start the CodaLab server locally.

    python manage.py runserver
    
  2. Open a browser and navigate to http://127.0.0.1:8000 to preview the site.

  3. When your next coding session comes along, remember to work in the virtual environment you created:

    Windows

    venv\Scripts\activate
    

    Linux

    source venv/bin/activate
    

...