Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def maybe_login(env):
try:
dl.setenv(env)
except:
dl.login()
dl.setenv(env)
import dtlpy as dl
dl.setenv('dev')
deployment = dl.projects.get(project_name='buffs_project').deployments.get(deployment_name="trial")
deployment.delete()
# or
plugin = dl.projects.get(project_name='buffs_project').plugins.get(plugin_name="trial")
plugin.delete()
print("erased . . . ")
def create_trainer():
dl.setenv('dev')
plugin_name = 'trainer'
project_name = 'ZazuProject'
project = dl.projects.get(project_name=project_name)
dl.projects.checkout(project_name)
dl.plugins.checkout(plugin_name)
###############
# push plugin #
###############
plugin = project.plugins.push(plugin_name=plugin_name,
src_path=os.getcwd())
plugin = project.plugins.get(plugin_name=plugin_name)
import dtlpy as dl
import os
path = '/home/noam/data'
dl.login_token(
'insert_token_here')
dl.setenv('dev')
project = dl.projects.get(project_id='buffs_project')
dataset_obj = project.datasets.get('my_data')
# dataset_obj.items.upload(local_path='/Users/noam/tiny_coco', remote_path='')
dataset_obj.items.download(local_path=path)
os.rename(os.path.join(path, 'items', 'tiny_coco'), os.path.join(path, 'tiny_coco'))
def __init__(self, configs, time, test_dataset_id, query):
logger.info('dtlpy version: ' + str(dl.__version__))
logger.info('dtlpy info: ' + str(dl.info()))
time = int(time)
dl.setenv('prod')
configs = json.loads(configs)
query = json.loads(query)
self.configs_input = dl.FunctionIO(type='Json', name='configs', value=configs)
self.service = dl.services.get('zazu')
project_name = configs['dataloop']['project']
self.project = dl.projects.get(project_name)
test_dataset = self.project.datasets.get(dataset_id=test_dataset_id)
maybe_download_pred_data(dataset_obj=test_dataset, val_query=query)
# add gt annotations
filters = dl.Filters()
filters.custom_filter = query
dataset_name = test_dataset.name
path_to_dataset = os.path.join(os.getcwd(), dataset_name)
# only download if doesnt exist
if not os.path.exists(path_to_dataset):
def create_tuner():
dl.setenv('prod')
plugin_name = 'tuner'
project_name = 'ZazuProject'
project = dl.projects.get(project_name=project_name)
###############
# push plugin #
###############
plugin = project.plugins.push(plugin_name=plugin_name,
src_path=os.getcwd(),
inputs=[{"type": "Json",
"name": "configs"}])
plugin = project.plugins.get(plugin_name=plugin_name)