Package: covalent-oci-plugin
Covalent OCI PluginCovalentis a Pythonic workflow tool used to execute tasks on advanced computing hardware.This executor plugin interfaces Covalent withOracle Cloud Infrastructure (OCI). ValidOCI credentialsare therefore required for use.1. Installation:warning: If you are just getting started with Covalent, check out thequickstart. We recommend using a virtual environment such asvenvorcondato minimize dependency conflicts.To use this plugin with Covalent, install it usingpip:pipinstallcovalentcovalent-oci-plugin2. Usage ExampleThe small workflow below demonstrates task execution with the OCI Executor.In the example, we train a Support Vector Machine (SVM) and use an instance of the executor to execute thetrain_svmelectron on an OCI compute instance. Note that we also usepip dependencieswhich will pre-install packages required to execute the electrons.:warning: Ensure the Covalent server is started before using this script by runningcovalent starton the command line.importcovalentasctfromnumpy.randomimportpermutationfromsklearnimportsvm,datasetsdeps_pip=["numpy==1.22.4","scikit-learn==1.1.2"]executor=ct.executor.OCIExecutor(availability_domain="giLp:US-ASHBURN-AD-1",shape="VM.Standard.E2.1",compartment_id="ocid1.compartment.oc1..unique-id",image_id="ocid1.image.oc1.iad.unique-id",subnet_id="ocid1.subnet.oc1.iad.unique-id",# ssh_key_file="~/.oci/id_rsa",)# Use executor plugin to train our SVM model@ct.electron(executor=executor,deps_pip=deps_pip)deftrain_svm(data,C,gamma):X,y=dataclf=svm.SVC(C=C,gamma=gamma)clf.fit(X[90:],y[90:])returnclf# When no executor is attached, the task runs locally@ct.electrondefload_data():iris=datasets.load_iris()perm=permutation(iris.target.size)iris.data=iris.data[perm]iris.target=iris.target[perm]returniris.data,iris.target@ct.electrondefscore_svm(data,clf):X_test,y_test=datareturnclf.score(X_test[:90],y_test[:90])@ct.latticedefrun_experiment(C=1.0,gamma=0.7):data=load_data()clf=train_svm(data=data,C=C,gamma=gamma)score=score_svm(data=data,clf=clf)returnscore# Dispatch the workflow.dispatch_id=ct.dispatch(run_experiment)(C=1.0,gamma=0.7)# Wait for our result and get result valueresult=ct.get_result(dispatch_id,wait=True).resultprint(result)During the execution of the workflow, one can navigate to the UI to see the status of the workflow. Once completed, the above script should also output a value with the score of our model.0.8666666666666667Note that some cloud infrastructure must already exists to run the above workflow, as noted inRequired OCI Resources.3. ConfigurationThere are many configuration options that can be passed in to the classct.executor.OCIExecutoror by modifying thecovalent config fileunder the section[executors.oci].For more information about all of the possible configuration values visit ourdocumentation pagefor this plugin.4. Required OCI ResourcesThe required OCI resources must first be provisioned before using this plugin:Virtual cloud network (VCN)Internet gatewayRoute tablePublic subnetSSH keyAPI signing keyCovalent'sresource deploymentfeature is very convenient for auto-creating these resources:covalentdeployupoci--compartment_ocid=<your-compartment-ocid>For this plugin the compartment ocid is a required parameter. This can be found and chosen from in theOCI console.For more information, see ourdocumentation pagefor this plugin.Getting Started with CovalentFor more information on how to get started with Covalent, check out the projecthomepageand the officialdocumentation.Release NotesRelease notes are available in theChangelog.CitationPlease use the following citation in any publications:https://doi.org/10.5281/zenodo.5903364LicenseCovalent is licensed under the Apache License 2.0. See theLICENSEfile or contact thesupport teamfor more details.