### Install Covalent using Pip Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Installs the Covalent library using the Python Package Index (PyPI) manager, which is the easiest and recommended method for quick setup. ```bash pip install cova ``` -------------------------------- ### Start the Covalent Server Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst After installation, this command initiates the Covalent server. It will typically start on a local host and port, providing a web interface for managing workflows. ```console $ covalent start Covalent server has started at http://localhost:48008 ``` -------------------------------- ### Install Covalent from Source (Build Web Dashboard) Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Clones the Covalent source repository and builds the web dashboard component. This step is part of the manual installation process from source. ```bash git clone git@github.com:AgnostiqHQ/covalent.git cd covalent # Build dashboard python setup.py webapp ``` -------------------------------- ### Install Covalent using Pip Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst This command installs the Covalent server and its associated libraries locally using the pip package manager. It's the first step to setting up Covalent on your system. ```bash $ pip install covalent ``` -------------------------------- ### Validate Covalent Installation Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Verifies that Covalent has been successfully installed by attempting to import the `covalent` module in Python. A successful import without errors indicates a correct installation. ```bash python -c "import covalent" ``` -------------------------------- ### Display Covalent CLI Help and Commands Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Shows the help message for the Covalent command-line interface, listing all available options and subcommands for managing the Covalent server and its services. ```console $ covalent --help Usage: covalent [OPTIONS] COMMAND [ARGS]... Covalent CLI tool used to manage the servers. Options: -v, --version Display version information. --help Show this message and exit. Commands: config Get and set the configuration of services. logs purge Shutdown server and delete the cache and config settings. restart Restart the server(s). start status Return the statuses of the server(s). stop Stop the server(s). ``` -------------------------------- ### Build Covalent Documentation Locally Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Builds the Covalent project documentation from source. This is useful for developers contributing to the documentation or for offline access. ```bash python setup.py docs ``` -------------------------------- ### Build and Install Covalent from Source using Conda Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Builds a Covalent package from the local source directory using Conda and then installs it from the local channel. This process can take a significant amount of time (10-15 minutes). ```bash conda build . conda install -c local covalent ``` -------------------------------- ### Start the Covalent Server Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Initiates the Covalent server and its various underlying components (e.g., data, dispatcher, NATS, UI). The output shows the status of each service as it starts. ```console $ covalent start Started Supervisord process 25109. Supervisord is running in process 25109. covalent:data STARTING covalent:dispatcher STARTING covalent:dispatcher_mq_consumer STARTING covalent:nats STARTING covalent:queuer STARTING covalent:results STARTING covalent:runner STARTING covalent:ui STARTING ``` -------------------------------- ### Install Covalent from Source (Developer Mode) Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Installs Covalent from the local source directory in editable (developer) mode using pip. This allows for direct modifications to the source code to take effect without reinstallation. ```bash pip install -e . ``` -------------------------------- ### Check Covalent Version (0.3x Migration) Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Displays the installed Covalent version using `pip show` and `grep`. This command is part of the migration process from older Covalent versions (e.g., 0.3x) to newer ones. ```console $ pip show cova | grep Version Version: 0.32.3 ``` -------------------------------- ### Install Documentation Build Dependencies Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Installs the necessary Python packages required to build the Covalent project's documentation. This command should be run from the `/covalent/doc` directory. ```bash pip install -r requirements.txt ``` -------------------------------- ### Covalent Core API Reference Overview Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst This section summarizes the key components available in the Covalent API, specifically `electron`, `lattice`, and various executors. It provides a high-level overview of their purpose and usage within Covalent workflows, guiding users to the full API documentation for detailed information. ```APIDOC Covalent API Reference: - electron: Description: Decorator to define a Covalent electron (a computational task). Usage: Applied to Python functions to mark them as executable tasks within a workflow. - lattice: Description: Decorator to define a Covalent lattice (a workflow composed of electrons). Usage: Applied to Python functions to orchestrate the execution flow of multiple electrons. - Executors: Description: Components responsible for executing electrons and lattices on various computational backends. Examples: LocalExecutor, AWSExecutor, SlurmExecutor, AzureExecutor. Purpose: Abstract away the underlying compute infrastructure, allowing workflows to run seamlessly across different environments. ``` -------------------------------- ### Upgrade Covalent to 0.8x using Pip Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Upgrades the Covalent installation to a specific 0.8x version (e.g., 0.89.2) using pip and then verifies the newly installed version. This is the recommended way to upgrade from older versions. ```console $ pip install cova==0.89.2 --upgrade $ pip show cova | grep Version Version: 0.89.2 ``` -------------------------------- ### Start Covalent Server Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/version_migrations/index.rst After installation and database migration, this command restarts the Covalent server. Once started, the server will be accessible at the specified local address, allowing users to resume their workflows. ```bash $ covalent start ``` -------------------------------- ### Install Project Dependencies via pip (Commented Example) Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/0_ClassicalMachineLearning/genai/source.ipynb This commented Python line provides a common command-line instruction for installing all project dependencies specified in a `requirements.txt` file using `pip`. It serves as a quick reference for setting up the development environment. ```python # Uncomment below line to install necessary libraries # !pip install requirements.txt ``` -------------------------------- ### Run Covalent with Docker Compose Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Clones the Covalent repository and starts Covalent services using Docker Compose, allowing Covalent to run in isolated containers. This method is useful for testing or development environments. ```bash git clone git@github.com:AgnostiqHQ/covalent.git cd covalent docker compose up -d ``` -------------------------------- ### Define and Dispatch a Simple Covalent Workflow Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst This snippet demonstrates how to define a Covalent workflow by decorating functions as `electrons` (tasks) and `lattices` (workflows). It then shows how to dispatch the workflow with input arguments, making it available for processing by the Covalent server. ```python import covalent as ct # Construct tasks as "electrons" @ct.electron def join_words(a, b): return ", ".join([a, b]) @ct.electron def excitement(a): return f"{a}!" # Construct a workflow of tasks @ct.lattice def simple_workflow(a, b): phrase = join_words(a, b) return excitement(phrase) # Dispatch the workflow dispatch_id = ct.dispatch(simple_workflow)("Hello", "World") ``` -------------------------------- ### Install Covalent using Conda Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Installs Covalent as a package within a Conda environment. This method is currently supported primarily for Linux users. ```bash conda install -c agnostiq covalent ``` -------------------------------- ### Install Project Dependencies via pip Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/1_QuantumMachineLearning/qaoa_maxcut/source.ipynb This commented-out line provides an example of how to install all necessary Python packages listed in `requirements.txt` using the `pip` package manager. It's a common step for setting up a Python project's environment. ```python # Install required packages # !pip install -r ./requirements.txt ``` -------------------------------- ### Run Covalent UI Web Application Locally Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Navigates into the Covalent UI webapp directory, installs its dependencies, and starts the development server, making the UI accessible via a local port in a web browser. ```shell cd covalent_ui/webapp yarn install yarn start ``` -------------------------------- ### Install Covalent Core and Developer Requirements Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Configures Conda channels, installs essential packages like setuptools, pip, yarn, and requests, builds the webapp, installs Covalent in editable mode, installs test requirements, and sets up pre-commit hooks. ```shell conda config --add channels conda-forge conda config --set channel_priority strict conda install setuptools pip yarn requests python setup.py webapp pip install -e . pip install -r tests/requirements.txt pre-commit install ``` -------------------------------- ### Configure Rsync for Remote File Transfer with Covalent Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst Demonstrates how to set up Rsync as a Covalent file transfer strategy for interacting with remote storage like NAS, and how to use it with `TransferFromRemote` and `TransferToRemote` within an electron task. ```python rsync = ct.fs_strategies.Rsync( username="user", host="storage.address.com", private_key_path="~/.ssh/id_rsa", ) input_file = ct.fs.TransferFromRemote( "file:///path/to/remote/input", "file:///path/to/local/input", strategy=rsync, ) output_file = ct.fs.TransferToRemote( "file:///path/to/remote/output", "file:///path/to/local/output", strategy=rsync, ) @ct.electron(files=[input_file, output_file]) def task(files): # input_file can be accessed at /path/to/local/input # output_file should be written to /path/to/local/output ... ``` -------------------------------- ### Build Covalent UI Web Application Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Navigates into the Covalent UI webapp directory, installs its dependencies, and then builds the optimized production version of the UI. ```shell cd covalent_ui/webapp yarn install yarn build ``` -------------------------------- ### Start Covalent Servers in Developer Mode Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Initiates the Covalent servers in a developer-friendly mode, allowing for local testing and development workflows. ```shell covalent start -d ``` -------------------------------- ### Enable Covalent service to start on system boot Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/deployment/deploy_with_systemd.rst This command configures the Covalent 'systemd' service to automatically start whenever the system boots up, ensuring Covalent is available after system restarts. ```bash systemctl enable covalent.service ``` -------------------------------- ### Implement Cloudbursting with Multiple Executors in Covalent Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst Demonstrates the concept of cloudbursting in Covalent, where task execution can be dynamically routed to different remote backends (e.g., Slurm, Azure) based on runtime scheduling decisions. ```python def task(): ... electrons = { "slurm": ct.electron(task, executor=slurm), "azure": ct.electron(task, executor=azure), } @ct.electron def schedule(num_cpu): # Query remote backends for availability ``` -------------------------------- ### Install Covalent using Pip Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/first_experiment/index.rst Installs the Covalent package using the Python package manager, Pip. This is the recommended installation method unless building from source. ```bash $ pip install covalent ``` -------------------------------- ### Define and Dispatch a Covalent Workflow Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst This Python code demonstrates how to construct a Covalent workflow. It defines individual tasks (electrons) using the `@ct.electron` decorator and then stitches them into a workflow (lattice) with `@ct.lattice`. The workflow is then dispatched and its result retrieved. ```python import covalent as ct # Construct manageable tasks out of functions # by adding the @ct.electron decorator @ct.electron def add(x, y): return x + y @ct.electron def multiply(x, y): return x*y # Note that electrons can be shipped to variety of compute # backends using executors, for example, "local" computer. # See below for other common executors. @ct.electron(executor="local") def divide(x, y): return x/y # Construct the workflow by stitching together # the electrons defined earlier in a function with # the @ct.lattice decorator @ct.lattice def workflow(x, y): r1 = add(x, y) r2 = [multiply(r1, y) for _ in range(4)] r3 = [divide(x, value) for value in r2] return r3 # Dispatch the workflow dispatch_id = ct.dispatch(workflow)(1, 2) result = ct.get_result(dispatch_id) print(result) ``` -------------------------------- ### Configure Covalent Azure Batch Executor Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst This code demonstrates the setup for an Azure Batch executor in Covalent. It enables containerizing and submitting tasks to an Azure Batch account, requiring authentication details like tenant ID, client ID, client secret, batch account URL, storage account name, and the target compute pool ID. ```python azure = ct.executor.AzureBatchExecutor( tenant_id="aad-tenant-id", client_id="service-principal-client-id", client_secret="service-principal-client-secret", batch_account_url="https://myaccount.az-region.batch.azure.com", storage_account_name="mystorage", pool_id="my-compute-pool-name", time_limit=300, ) ``` -------------------------------- ### Perform Dynamic Hardware Selection in Covalent Workflows Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst Illustrates how to dynamically select compute resources, such as requesting a GPU for large problems or specifying CPU cores, within a Covalent workflow based on runtime conditions and problem size. ```python @ct.electron def get_problem_size(): ... def task(): ... @ct.electron def schedule(problem_size, threshold): executor_args = { ... "options":{"time": "01:00:00"} } # Request a GPU for large computational problems if problem_size > threshold: executor_args["options"]["gres"] = "gpu:v100:1" else: executor_args["options"]["cpus-per-task"] = 4 return ct.executor.SlurmExecutor(**executor_args) @ct.electron @ct.lattice def dynamic_sublattice(problem_size): threshold = 10 ** 6 return ct.electron( task, executor=schedule(problem_size, threshold) )() @ct.lattice def workflow(): problem_size = get_problem_size() return dynamic_sublattice(problem_size) ``` -------------------------------- ### Implement Conditional Logic in Covalent Dynamic Workflows Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst Demonstrates how to build dynamic sublattices in Covalent that incorporate conditional `if/else` logic based on upstream task outputs, allowing for flexible execution paths. ```python @ct.electron def is_odd(number): return number % 2 @ct.electron def f(): ... @ct.electron @ct.lattice def dynamic_sublattice(condition): x = 0 if condition: x += f() return x @ct.lattice def workflow(input): return dynamic_sublattice(is_odd(input)) ``` -------------------------------- ### Run Covalent Python Server Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/README.md Navigates to the Covalent UI directory and starts the Python backend server. Python version 3.10 is recommended for optimal compatibility and performance. ```shell cd covalent_ui python app.py ``` -------------------------------- ### Install Node.js (v16 or later) Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/README.md Provides commands to install Node.js, a JavaScript runtime, on different operating systems. Node.js is required for building and running the Covalent web application. ```shell # Linux curl -sL https://deb.nodesource.com/setup_16.x | bash - apt-get install -y nodejs ``` ```shell # macOS brew install node ``` -------------------------------- ### Install Node.js v16 for Covalent UI Development Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Provides commands to install Node.js version 16, a prerequisite for Covalent UI development, on both Linux (using apt-get) and macOS (using Homebrew). ```shell # Linux curl -sL https://deb.nodesource.com/setup_16.x | bash - apt-get install -y nodejs ``` ```shell # macOS brew install node ``` -------------------------------- ### Install and Activate Node.js v16 with NVM Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Uses Node Version Manager (NVM) to install Node.js version 16 and then activates it, which is required for Covalent's local development. ```shell nvm install 16 nvm use 16 ``` -------------------------------- ### Install Python Packages from Requirements File Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/TUTORIAL_GUIDELINES.md A commented-out line for a Jupyter notebook cell, demonstrating how to install all required Python packages listed in `requirements.txt` using `pip`. This line should be present but commented out for functional tests, allowing users to uncomment and install dependencies if needed. ```Shell # Install necessary packages # !pip install -r ./requirements.txt ``` -------------------------------- ### Install Covalent Python Package Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/README.md Installs the Covalent Python package in editable mode, typically after cloning the repository. This allows for local development and changes to be reflected without reinstallation. ```shell cd /covalent pip install -e . ``` -------------------------------- ### Build and Tag Covalent Server Docker Image Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Builds the Covalent server Docker image. The first example shows a basic build, while the second demonstrates how to include build arguments for date and version for improved traceability. ```shell docker build --tag covalent-server:latest . ``` ```shell docker build --build-arg COVALENT_BUILD_DATE=`date -u +%Y-%m-%d` --build-arg COVALENT_BUILD_VERSION=`cat ./VERSION` --tag covalent-server:`cat ./VERSION` . ``` -------------------------------- ### Run Covalent Web Application Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/README.md Starts the Covalent web application in development mode. This command typically launches a local development server that serves the UI. ```shell yarn start ``` -------------------------------- ### Start Covalent Server Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/3_QuantumChemistry/dynamic_quantum_chemistry/source.ipynb Initializes and starts the Covalent server, which is necessary for dispatching and managing computational workflows defined with Covalent. ```Python ct.covalent_start() ``` -------------------------------- ### Specify Pip Dependencies for Covalent Electrons Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst Shows how to declare Python package dependencies using `ct.DepsPip` and attach them to a Covalent electron, ensuring required packages like NumPy are available before task execution. ```python deps = ct.DepsPip(packages=["numpy==1.25.0"]) @ct.electron(deps_pip=deps) def task(): import numpy ... ``` -------------------------------- ### Achieve Dynamic Parallelism in Covalent Workflows Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst Shows how to dynamically determine the number of parallel tasks at runtime within a Covalent workflow, enabling scalable execution based on computed values. ```python @ct.electron def determine_num_nodes(): ... @ct.electron def task(): ... @ct.electron @ct.lattice def dynamic_sublattice(num_nodes): data = [task() for node in range(num_nodes)] return data @ct.lattice def workflow(): num_nodes = determine_num_nodes() return dynamic_sublattice(num_nodes) ``` -------------------------------- ### Configure Directory Triggers for Covalent Workflows Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst Illustrates how to use `ct.triggers.DirTrigger` to automatically run a Covalent lattice workflow when specific file system events (e.g., creation, modification) occur in a monitored directory. ```python trigger = ct.triggers.DirTrigger( dir_path="/path/to/watch", event_names=["created", "modified"], ) @ct.lattice(triggers=trigger) def task(): ... ``` -------------------------------- ### Build Covalent Docker Image with Specific Source Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Demonstrates how to build Covalent Docker images by specifying the Covalent source using build arguments. Examples include pulling from a PyPI release or a specific GitHub commit SHA. ```shell docker build --build-arg COVALENT_SOURCE=pypi --build-arg COVALENT_RELEASE=0.202.0.post1 . ``` ```shell docker build --build-arg COVALENT_SOURCE=sha --build-arg COVALENT_COMMIT_SHA=abcdef . ``` -------------------------------- ### Run React Development Server with Yarn Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/webapp/README.md Starts the React application in development mode. It opens the app in your browser at http://localhost:3000 and automatically reloads the page upon code edits. Lint errors will be displayed in the console. ```Shell yarn start ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/6_PennylaneRepoTutorials/univariate_qvr/source.ipynb Installs required Python packages from the `requirements.txt` file using pip. ```bash !pip install -r ./requirements.txt ``` -------------------------------- ### Build Covalent Web Application Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/README.md Navigates to the web app directory, installs JavaScript dependencies using Yarn, and then builds the optimized production version of the web application. This step compiles frontend assets. ```shell cd covalent_ui/webapp yarn install yarn build ``` -------------------------------- ### Define Covalent Dynamic Sublattice Workflow Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst This Python code defines two Covalent components: `dynamic_sublattice` (an electron and lattice) which dynamically selects a backend, and `workflow` (a lattice) which orchestrates the execution of the sublattice based on CPU requirements. It demonstrates the use of `@ct.electron` and `@ct.lattice` decorators for building computational graphs. ```python @ct.electron @ct.lattice def dynamic_sublattice(backend): return electrons[backend]() @ct.lattice def workflow(num_cpu): backend = schedule(num_cpu) return dynamic_sublattice(backend) ``` -------------------------------- ### Configure Covalent Slurm Executor Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/quick_start/index.rst This snippet shows how to initialize a Slurm executor in Covalent. It allows users to submit tasks to a Slurm cluster by specifying connection details, SSH key, remote working directory, Conda environment, and Slurm-specific options like CPU count and quality of service. ```python slurm = ct.executor.SlurmExecutor( username="user", address="cluster.hostname.net", ssh_key_file="~/.ssh/id_rsa", remote_workdir="/scratch/user", conda_env="covalent", options={ "cpus-per-task": 32, "qos": "regular", "time": "00:30:00", "constraint": "cpu", }, ) @ct.electron(executor=slurm) def task(): ... ``` -------------------------------- ### Defining and Executing a Covalent Lattice Workflow Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Provides a comprehensive example of defining an `@ct.electron` and an `@ct.lattice` workflow, dispatching it with parameters, and retrieving the execution result. The output format of the `Lattice Result` is also shown. ```python >>> @ct.electron ... def identity(x): ... return x ... >>> @ct.lattice ... def pipeline(a): ... res = identity(a) ... return res ... >>> dispatch_id = ct.dispatch(pipeline)(a=1) >>> result = pipeline.get_result(dispatch_id=dispatch_id) >>> print(result) Lattice Result ============== status: COMPLETED result: 1 inputs: {'a': 1} error: None start_time: 2022-01-24 04:13:00.667919+00:00 end_time: 2022-01-24 04:13:00.684457+00:00 results_dir: /home/user/covalent dispatch_id: e4efd26c-240d-4ab1-9826-26ada91e429f ``` -------------------------------- ### Start the Covalent Server Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/first_experiment/index.rst Initiates the Covalent server process from the command line. Upon successful startup, it displays the local URL where the server is accessible. ```console $ covalent start Covalent server has started at http://localhost:48008 ``` -------------------------------- ### Placeholder for Python Package Installation Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/6_PennylaneRepoTutorials/univariate_qvr/source.ipynb This Python snippet is a comment indicating where commands for installing necessary packages would typically be placed. It serves as a placeholder for package management operations, often followed by actual installation commands like 'pip install -r requirements.txt'. ```python # Install necessary packages ``` -------------------------------- ### Build React Application for Production with Yarn Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/webapp/README.md Compiles and bundles the React application for production deployment. This process optimizes the build for best performance, minifies the code, and includes hashes in filenames, making the app ready for deployment. ```Shell yarn build ``` -------------------------------- ### View Covalent CLI Main Help Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/first_experiment/index.rst Displays the main help message for the Covalent command-line interface, outlining available options and a list of subcommands for managing the Covalent server. ```console $ covalent --help Usage: covalent [OPTIONS] COMMAND [ARGS]... Covalent CLI tool used to manage the servers. Options: -v, --version Display version information. --help Show this message and exit. Commands: logs Show Covalent server logs. purge Shutdown server and delete the cache and config settings. restart Restart the server. start Start the Covalent server. status Query the status of the Covalent server. stop Stop the Covalent server. ``` -------------------------------- ### Validate Covalent Installation Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/first_experiment/index.rst Optionally verifies that Covalent has been properly installed by attempting to import the 'covalent' module in Python. The command should return without any errors if the installation is successful. ```bash $ python -c "import covalent" ``` -------------------------------- ### Build and Install Covalent Application Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/build_from_source.rst Changes directory to Covalent, builds the web dashboard using `setup.py webapp`, and then installs Covalent in developer mode using pip. This prepares the Covalent application for local development and use. ```bash $ cd covalent # Build the dashboard $ python setup.py webapp # Install using pip (-e is for developer mode) $ pip install -e . ``` -------------------------------- ### Build Covalent Local Documentation Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/build_from_source.rst Changes directory to Covalent and uses the `setup.py docs` command to build the project's documentation. The generated HTML files will be located in `covalent/doc/build/html`. ```bash $ cd covalent $ python setup.py docs ``` -------------------------------- ### Check Covalent Server Status Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Displays the current operational status of all Covalent server components, including their process IDs and uptime. This command is useful for confirming that all services are running correctly. ```console $ covalent status Supervisord is running in process 25109. covalent:data RUNNING pid 25660, uptime 0:16:03 covalent:dispatcher RUNNING pid 25658, uptime 0:16:03 covalent:dispatcher_mq_consumer RUNNING pid 25663, uptime 0:16:03 covalent:nats RUNNING pid 25656, uptime 0:16:03 covalent:queuer RUNNING pid 25657, uptime 0:16:03 covalent:results RUNNING pid 25662, uptime 0:16:03 covalent:runner RUNNING pid 25659, uptime 0:16:03 covalent:ui RUNNING pid 25661, uptime 0:16:03 ``` -------------------------------- ### Retrieve Covalent Workflow Results Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst After a Covalent workflow completes, this snippet illustrates how to retrieve its results using its unique dispatch ID. The `.result` attribute is used to access the final output of the workflow. ```python import covalent as ct dispatch_id = "8a7bfe54-d3c7-4ca1-861b-f55af6d5964a" result_string = ct.get_result(dispatch_id).result ``` -------------------------------- ### Purge Covalent Server Configuration (0.3x Migration) Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst Stops the Covalent server and purges its configuration files. This command is crucial for a clean slate when migrating from older Covalent versions like 0.3x. ```console $ covalent purge Covalent server has stopped. Covalent server files have been purged. ``` -------------------------------- ### Stop Covalent Server Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/microservices/index.rst This console command is used to gracefully stop all running Covalent server components, including the dispatcher, data services, UI, and other background processes. It provides feedback on which services are being stopped. ```console $ covalent stop Supervisord is running in process 25109. covalent:dispatcher_mq_consumer: stopped covalent:data: stopped covalent:nats: stopped covalent:ui: stopped covalent:results: stopped covalent:queuer: stopped covalent:dispatcher: stopped covalent:runner: stopped ``` -------------------------------- ### Installing Python Dependencies Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/1_QuantumMachineLearning/pennylane_kernel/source.ipynb This commented-out line provides a command to install all necessary Python packages listed in the 'requirements.txt' file using pip. It's a standard practice for setting up the project's environment. ```python # Install necessary packages # !pip install -r ./requirements.txt ``` -------------------------------- ### Installing Python Dependencies via pip Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/1_QuantumMachineLearning/quantum_embedding_kernel/source.ipynb This Python code block, presented as a commented-out shell command, illustrates how to install all necessary project dependencies listed in `requirements.txt` using pip. It's a standard procedure for setting up the environment to run the tutorial. ```python # Install required packages # !pip install -r ./requirements.txt ``` -------------------------------- ### Python Variable Docstring Example Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Example of documenting a Python variable using a docstring immediately below its definition, specifying its type and purpose. ```python num_gates = {"CNOT": 17, "RY": 31} """dict[str, int]: Number of gates in wire 2""" ``` -------------------------------- ### Build Covalent Project Documentation Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Initiates the documentation build process for the Covalent project. This command should be executed from the root directory of the repository (`/covalent/`). ```bash python setup.py docs ``` -------------------------------- ### Install Yarn Globally Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Installs the Yarn package manager globally using npm, which is required for managing dependencies in Covalent UI development. ```shell npm install --global yarn ``` -------------------------------- ### Example Python Requirements File Content Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/TUTORIAL_GUIDELINES.md An example of the contents of a `requirements.txt` file, showing how Covalent should be listed without a version number, alongside other Python packages with their specific versions. This file specifies all necessary dependencies for the tutorial. ```Text covalent matplotlib==3.6.3 pennylane==0.25.1 scikit-learn==1.0.2 torch==1.13.1 ``` -------------------------------- ### Comment for Package Installation Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/1_QuantumMachineLearning/pennylane_iris_classification/source.ipynb This Python snippet is a single-line comment indicating the intended location for commands to install necessary project packages. It acts as a placeholder for dependency setup instructions. ```python # Install necessary packages ``` -------------------------------- ### Install Covalent Documentation Dependencies Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/build_from_source.rst Navigates to the Covalent documentation directory and installs all Python packages required for building the documentation, as specified in `covalent/doc/requirements.txt`. This step is necessary before generating local documentation. ```bash $ cd covalent/doc $ pip install -r requirements.txt ``` -------------------------------- ### Install Pandoc Python Wrapper Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Installs the 'pandoc' Python package, which can resolve 'pandoc missing' errors encountered during the documentation build process. This is a common fix if pandoc is not found. ```bash pip install pandoc ``` -------------------------------- ### Create and Dispatch a Covalent Workflow (Hello World) Source: https://github.com/agnostiqhq/covalent/blob/develop/tests/qa/qa_requirements.ipynb This example demonstrates the fundamental steps to create a Covalent workflow. It defines two 'electron' tasks (`join_words`, `excitement`) and composes them into a 'lattice' workflow (`simple_workflow`). The workflow is then dispatched, and its result is retrieved and asserted. ```python import covalent as ct # Construct tasks as "electrons" @ct.electron def join_words(a, b): return ", ".join([a, b]) @ct.electron def excitement(a): return f"{a}!" # Construct a workflow of tasks @ct.lattice def simple_workflow(a, b): phrase = join_words(a, b) return excitement(phrase) # Dispatch the workflow dispatch_id = ct.dispatch(simple_workflow)("Hello", "World") result = ct.get_result(dispatch_id=dispatch_id, wait=True) assert result.result == 'Hello, World!' ``` -------------------------------- ### Reload systemd daemon and start Covalent service Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/deployment/deploy_with_systemd.rst These commands reload the 'systemd' daemon to recognize new or modified unit files and then start the Covalent service. 'daemon-reload' is only necessary after modifying a unit file. ```bash systemctl daemon-reload systemclt start covalent.service ``` -------------------------------- ### Install Yarn Globally Source: https://github.com/agnostiqhq/covalent/blob/develop/covalent_ui/README.md Installs Yarn, a fast, reliable, and secure dependency management tool for JavaScript, globally using npm. Yarn is used for managing frontend dependencies and building the web application. ```shell npm install --global yarn ``` -------------------------------- ### View Covalent CLI Subcommand Help (stop) Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/first_experiment/index.rst Provides specific help documentation for a given Covalent CLI subcommand, such as 'stop', detailing its usage and available options. ```console $ covalent stop --help Usage: covalent stop [OPTIONS] Stop the Covalent server. Options: --help Show this message and exit. ``` -------------------------------- ### Identify Installed Covalent Version Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/version_migrations/index.rst This command uses `pip show` to display details about the Covalent package and `grep` to filter for the 'Version' line, allowing users to quickly ascertain their currently installed Covalent version. ```bash $ pip show covalent | grep Version ``` -------------------------------- ### Start Covalent Docker Container with Custom Configuration Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/deployment/deploy_with_docker.rst An example demonstrating how to start the Covalent Docker container with specific environment variables. This command configures Covalent to use two Dask workers and listen on TCP port 8000. ```bash docker container run --name covalent -p 8000:8000 -e COVALENT_NUM_WORKERS=2 -e COVALENT_SVC_PORT=8000 public.ecr.aws/covalent/covalent:latest ``` -------------------------------- ### Install or Upgrade Covalent with Pip Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/version_migrations/index.rst These commands facilitate the upgrade of Covalent to a specific version (e.g., 0.202.0) using pip's `--upgrade` flag. The second command verifies that the new version has been successfully installed. ```bash $ pip install covalent==0.202.0 --upgrade $ pip show covalent | grep Version ``` -------------------------------- ### Extend Covalent Lambda Executor Dockerfile Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/api/executors/awslambda.rst Example Dockerfile to extend the Covalent AWS Lambda base executor image by installing additional Python packages like numpy, pandas, and scipy. It ensures packages are installed to the correct path (`/var/task`) using the `LAMBDA_TASK_ROOT` build argument. ```docker # Dockerfile FROM public.ecr.aws/covalent/covalent-lambda-executor:stable as base RUN pip install --target ${LAMBDA_TASK_ROOT} numpy pandas scipy ``` -------------------------------- ### Covalent CLI Help Command Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/api/api.rst Demonstrates how to access the Covalent command-line interface help documentation to understand available utilities for server management. ```bash covalent --help ``` -------------------------------- ### Displaying Project Requirements Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/1_QuantumMachineLearning/pennylane_kernel/source.ipynb This snippet reads and prints the contents of the 'requirements.txt' file, which typically lists the Python package dependencies for the project. It helps in understanding the necessary environment setup. ```python with open("./requirements.txt", "r") as file: for line in file: print(line.rstrip()) ``` -------------------------------- ### Start Covalent Server with Increased Executor Memory Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/troubleshooting.rst This command starts the Covalent server, allocating 2GB of memory per worker for 4 workers. It is specifically used to address workflow failures caused by insufficient executor memory, particularly for Dask executors, provided the user has enough available memory. ```bash covalent start -n 4 -m "2GB" -d ``` -------------------------------- ### Retrieve Covalent Server Logs for Workflow Status Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/troubleshooting.rst This command allows users to view the logs of the Covalent server. It is essential for diagnosing issues like hanging workflows by providing detailed information on the server's status and ongoing processes. For more informative logs, the server can be started with `covalent start -d`. ```bash covalent logs ``` -------------------------------- ### Run Streamlit Application from Command Line Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/voice_cloning/source.ipynb This bash command demonstrates how to execute a Streamlit Python script. It initiates the Streamlit server, making the web application accessible in a browser. ```bash streamlit run your_script.py ``` -------------------------------- ### Install Covalent Python Dependencies Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/getting_started/build_from_source.rst Navigates into the Covalent directory and installs all required Python packages listed in `covalent/requirements.txt` using pip. This ensures all necessary libraries are available for building and running Covalent. ```bash $ cd covalent $ pip install -r requirements.txt ``` -------------------------------- ### Run Covalent Tests with Pytest Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Executes Covalent's test suite using pytest with verbose output to verify the installation and functionality of the project. ```shell pytest -v ``` -------------------------------- ### Install Python Packages from Requirements Source: https://github.com/agnostiqhq/covalent/blob/develop/doc/source/tutorials/1_QuantumMachineLearning/pennylane_hybrid/source.ipynb This commented-out Python command illustrates how to install all necessary project dependencies listed in `requirements.txt` using the `pip` package manager. It's a standard step for setting up the development environment. ```python # !pip install -r requirements.txt ``` -------------------------------- ### Build Covalent SDK Docker Image Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Builds the Covalent SDK Docker image, specifying the installation type as 'sdk'. This is useful for containerized tasks that utilize Covalent. ```shell docker build --build-arg COVALENT_INSTALL_TYPE=sdk --tag covalent-sdk:latest . ``` -------------------------------- ### Dispatching a Covalent Workflow Source: https://github.com/agnostiqhq/covalent/blob/develop/CONTRIBUTING.md Demonstrates how to dispatch a Covalent workflow using the `ct.dispatch` function, returning a unique dispatch ID. This example uses Python console syntax. ```python >>> ct.dispatch(pipeline)(**params) # Dispatching a workflow returns a unique dispatch id. '8a7bfe54-d3c7-4ca1-861b-f55af6d5964a' ```