Job New SDK

Overview

When a job is created it returns info and the job_id. job_id is what's used to make changes to other objects that interact with the job.

SDK

Function

dir = project.directory.get(name = 'Default') member_list = project.get_member_list() member_list_ids = [x['member_id'] for x in member_list] job = project.job.new( name = "my job test pablo 222", instance_type = "box", share = "Project", sync_directories = [dir], label_schema_id = 1, tag_list = ["super", "apples", "something"], members_list_ids = member_list_ids, auto_launch = True )

Input Files, Create a new Guide, and Launch a Job Example

On this example we do some file uploads, then create a guide and finally launch a job with this guide and the Default dataset attached to it. The job is automatically launched to start labeling.

from diffgram import Project from glob import glob project = Project( project_string_id = "replace_with_project_string", client_id = "replace_with_client_id", client_secret = "replace_with_client_secret") directory_path = "../replace_with_your_directory/*" path_list = glob.glob(directory_path) file_list = [] for path in path_list: # Replace with from_url() method if possible file = project.file.from_local(path) file_list.append(file) guide = project.guide.new( name = "Traffic lights", description_markdown = "my description" ) dir = project.directory.get(name = 'Default') member_list = project.get_member_list() member_list_ids = [x['member_id'] for x in member_list] job = project.job.new( name = "my job", instance_type = "box", share = "Project", file_list = file_list, guide = guide, sync_directories = [dir], members_list_ids = member_list_ids, auto_launch = True )

After creating your job it can be viewed on the Diffgram.com UI. It can be launched from there with the same effect.

Label Schema

By default, a newly created job will include the default Label Schema, or you can specify a schema with label_schema_id

Launch()

The job can be launched by calling job.launch()

or by calling Job Launch API.

Note that jobs are created in a draft state by default, and must be launched to start syncing files.

Attaching Datasets with Job New

Note that there is a dict with the first key being a list attached_directories_list.

attached_directories_dict: { attached_directories_list: [ { "selected": "sync", "directory_id": 2 } ] }

Did this page help you?