You can set up custom tasks to have public network access. The code examples on this page showcase a binary estimator task that uses an API endpoint with credentials to gain network access.
Before configuring network access, you must be able to provide your credentials ID. After setting up your own credentials, open your DataRobot user profile and select Credentials Management.
Select your credentials. Once selected, you can copy the credentials ID. The ID is the string that follows /credentials-management/ in the URL.
Review the example below of how to add credentials to model-metadata.yaml. You can access the example file in the DRUM repo. The typeSchema is copied from another example in the DRUM repo.
Example: model-metadata.yaml
name:13_python_credentials_and_internet_accesstype:trainingenvironmentID:5e8c889607389fe0f466c72dtargetType:binary# These must be actual DataRobot credentials that the author ownsuserCredentialSpecifications:-key:MY_CREDENTIAL# A legal POSIX env var keyvalueFrom:655270e368a555f026e2512d# A credential ID from DataRobot for which you are the ownerreminder:my super-cool.com/api api-token# Optional: any string value that you for a remindertypeSchema:input_requirements:-field:data_typescondition:INvalue:-NUM-field:number_of_columnscondition:NOT_LESS_THANvalue:2-field:sparsecondition:EQUALSvalue:SUPPORTED# This requirement is only ignored because this is an example using test data
In order to have network access from within a custom task, you need to specifically enable it in the Custom Task Version using the outgoingNetworkPolicy field. Any new versions will inherit the previous version's outgoingNetworkPolicy unless you specify a different one. To do so, you must the the REST API.
Availability information
Network access for custom tasks requires usage of DataRobot's early access Python client. You can install the early access client using pip install datarobot_early_access.
If you want to test in DRUM with your credentials, you can fake the data by making a secrets directory and putting all of your secrets there. You can view the example in the DRUM repo.
Each secret file should have corresponding credentials with the same name. The contents of a secret file should be a JSON string that can be cast to one of the secrets objects. All secrets objects are in custom_model_runner/datarobot_drum/custom_task_interfaces/user_secrets.py. Your secret response must contain a credential_type, which is another name for datarobot_drum.custom_task_interfaces.user_secrets.SecretType; however, the value must be all lowercase (SecretType.SNOWFLAKE_KEY_PAIR_USER_ACCOUNT corresponds to {"credential_type": "snowflake_key_pair_user_account"}).