Unanswered
			
			
 
			
	
		
			
		
		
		
		
	
			
		
		Hey Everyone. Can Someone Help Me Understand How Task
This is the snippet that works for me. Please be aware that I use a custom Task.init call at the start of my script ( repo/main_scripts/train.py  ), so if you don't do that you need to set add_task_init_call to True.
try:
        repo = os.popen('git remote -v').read().strip().split('\n')
        if len(repo) > 2:
            raise RuntimeError('More than one git repository found')
        repo = repo[0].split('\t')[-1].split(' ')[0]
        branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
        commit = os.popen('git rev-parse HEAD').read().strip()
    except Exception as e:
        logging.error(f'Error getting git repository: {e}')
        raise RuntimeError('Error getting git repository')
    clearml.Task.force_requirements_env_freeze(True)
    # Create a task in ClearML
    task = clearml.Task.create(
        project_name=parameters['experiment']['project_name'],
        task_name=parameters['experiment']['experiment_name'],
        task_type=task_type,
        repo=repo,
        branch=branch,
        commit=commit,
        packages=True,
        script=script,
        add_task_init_call=False,
    )
    task.set_tags(parameters['experiment']['tags'])
    task.set_script(repository=repo, branch=branch, entry_point=script)
    task.connect_configuration(parameters)
102 Views
				0
Answers
				
					 
	5 months ago
				
					
						 
	5 months ago
					
			