Skip to content

studio-api #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7618f8c
starter
jonathanfeng-scale Nov 22, 2022
8a5c568
hash
jonathanfeng-scale Nov 22, 2022
6508c32
small updates
jonathanfeng-scale Nov 22, 2022
e6b2730
remove unneeded paginator
jonathanfeng-scale Nov 23, 2022
fce080f
typo
jonathanfeng-scale Nov 30, 2022
a15c46b
draft new methods
rodsca Nov 30, 2022
caf468e
Merge branch 'studio-api' of https://github.com/scaleapi/scaleapi-pyt…
rodsca Nov 30, 2022
ec7555d
str -> arr of str
lautarorangil Dec 2, 2022
8e7d410
return dict for method
lautarorangil Dec 2, 2022
e1e1373
small fixes from testing
jonathanfeng-scale Dec 6, 2022
39a855e
tests and fixes
jonathanfeng-scale Dec 6, 2022
c629206
formatting
jonathanfeng-scale Dec 6, 2022
d162e8f
pythonblack reformat
jonathanfeng-scale Dec 6, 2022
55c2d87
more formatting
jonathanfeng-scale Dec 6, 2022
75b22a2
Update .pylintrc
jonathanfeng-scale Dec 6, 2022
99fc295
Update test_client.py
jonathanfeng-scale Dec 6, 2022
7488613
Update test_client.py
jonathanfeng-scale Dec 6, 2022
d23ffdf
comments for pylint
jonathanfeng-scale Dec 6, 2022
a5c111d
add studio api documentation
jonathanfeng-scale Dec 8, 2022
5fd9adb
bump version number
jonathanfeng-scale Dec 8, 2022
810cf03
title underlining
jonathanfeng-scale Dec 8, 2022
b890d72
small version edit
jonathanfeng-scale Dec 8, 2022
cf3fbd8
typo
jonathanfeng-scale Dec 8, 2022
df93aec
typos
jonathanfeng-scale Dec 8, 2022
17b78e3
typos
jonathanfeng-scale Dec 8, 2022
b895772
fixes
jonathanfeng-scale Dec 8, 2022
0ccec8b
Merge branch 'studio-api' of https://github.com/scaleapi/scaleapi-pyt…
jonathanfeng-scale Dec 8, 2022
600a344
formatting
jonathanfeng-scale Dec 8, 2022
6a05ce1
Update __init__.py
jonathanfeng-scale Dec 8, 2022
216b23a
better test cases
jonathanfeng-scale Dec 12, 2022
baf495c
last_tests
lautarorangil Dec 13, 2022
5a2c06a
remove broken test
jonathanfeng-scale Dec 14, 2022
ea3e6ba
formatting
jonathanfeng-scale Dec 14, 2022
13a6cde
formatting
jonathanfeng-scale Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ disable=
too-many-arguments,
too-many-instance-attributes,
invalid-name,
too-many-lines, # __init__.py is > 1000 lines
180 changes: 179 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,49 @@ The attribute can be passed to the task payloads, in the ``attachment`` paramete
...
...
)

Manage Teammates
________________

Manage the members of your Scale team via API. Check out `Scale Team API Documentation`__ for more information.

__ https://docs.scale.com/reference/teams-overview

List Teammates
^^^^^^^^^^^^^^

Lists all teammates in your Scale team.
Returns all teammates in a List of Teammate objects.

.. code-block:: python

teammates = client.list_teammates()

Invite Teammate
^^^^^^^^^^^^^^^

Invites a list of email strings to your team with the provided role.
The available teammate roles are: 'labeler', 'member', or 'manager'.
Returns all teammates in a List of Teammate objects.

.. code-block:: python

from scaleapi import TeammateRole

teammates = client.invite_teammates(['email1@example.com', 'email2@example.com'], TeammateRole.Member)

Update Teammate Role
^^^^^^^^^^^^^^^^^^^^^

Updates a list of emails of your Scale team members with the new role.
The available teammate roles are: 'labeler', 'member', or 'manager'.
Returns all teammates in a List of Teammate objects.

.. code-block python

from scaleapi import TeammateRole

teammates = client.update_teammates_role(['email1@example.com', 'email2@example.com'], TeammateRole.Manager)

Example Scripts
_______________
Expand Down Expand Up @@ -612,6 +655,139 @@ Create a training task.

client.create_training_task(TaskType, ...task parameters...)

Studio Assignments (For Scale Studio only)
__________________________________________

Manage project assignments for your labelers.

List All Assignments
^^^^^^^^^^^^^^^^^^^^

Lists all your Scale team members and the projects they are assigned to.
Returns a dictionary of all teammate assignments with keys as 'emails' of each teammate, and values as a list of project names the teammate are assigned to.

.. code-block:: python

assignments = client.list_studio_assignments()
my_assignment = assignments.get('my-email@example.com')

Add Studio Assignment
^^^^^^^^^^^^^^^^^^^^^

Assigns provided projects to specified teammate emails.

Accepts a list of emails and a list of projects.

Returns a dictionary of all teammate assignments with keys as 'emails' of each teammate, and values as a list of project names the teammate are assigned to.

.. code-block:: python

assignments = client.add_studio_assignments(['email1@example.com', 'email2@example.com'], ['project 1', 'project 2'])


Remove Studio Assignment
^^^^^^^^^^^^^^^^^^^^^^^^

Removes provided projects from specified teammate emails.

Accepts a list of emails and a list of projects.

Returns a dictionary of all teammate assignments with keys as 'emails' of each teammate, and values as a list of project names the teammate are assigned to.

.. code-block:: python

assignments = client.remove_studio_assignments(['email1@example.com', 'email2@example.com'], ['project 1', 'project 2'])

Studio Project Groups (For Scale Studio Only)
_____________________________________________

Manage groups of labelers in our project by using Studio Project Groups.

List Studio Project Groups
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns all labeler groups for the specified project.

.. code-block:: python

list_project_group = client.list_project_groups('project_name')

Add Studio Project Group
^^^^^^^^^^^^^^^^^^^^^^^^

Creates a project group with the provided group_name for the specified project and adds the provided teammate emails to the new project group. The team members must be assigned to the specified project in order to be added to the new group.

Returns the created StudioProjectGroup object.

.. code-block:: python

added_project_group = client.create_project_group(
'project_name', ['email1@example.com'], 'project_group_name'
)

Update Studio Project Group
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Assign or remove teammates from a project group.

Returns the updated StudioProjectGroup object.

.. code-block:: python

updated_project_group = client.update_project_group(
'project_name', 'project_group_name', ['emails_to_add'], ['emails_to_remove']
)

Studio Batches (For Scale Studio Only)
_______________________________________

Get information about your pending Studio batches.

List Studio Batches
^^^^^^^^^^^^^^^^^^^

Returns a list of StudioBatch objects for all pending Studio batches.

.. code-block:: python

studio_batches = client.list_studio_batches()

Assign Studio Batches
^^^^^^^^^^^^^^^^^^^^^^

Sets labeler group assignment for the specified batch.

Returns a StudioBatch object for the specified batch.

.. code-block:: python

assigned_studio_batch = client.assign_studio_batches('batch_name', ['project_group_name'])

Set Studio Batches Priority
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sets the order to prioritize your pending Studio batches. You must include all pending studio batches in the List.

Returns a List of StudioBatch objects in the new order.

.. code-block:: python

studio_batch_priority = client.set_studio_batches_priorities(
['pending_batch_1', 'pending_batch_2', 'pending_batch_3']
)

Reset Studio Batches Priority
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Resets the order of your Studio batches to the default order, which prioritizes older batches first.

Returns a List of StudioBatch objects in the new order.

.. code-block:: python

reset_studio_batch_prioprity = client.reset_studio_batches_priorities()


Error handling
______________

Expand Down Expand Up @@ -642,7 +818,9 @@ For example:
print(err.code) # 400
print(err.message) # Parameter is invalid, reason: "attachments" is required



Troubleshooting
_______________

If you notice any problems, please email us at support@scale.com.
If you notice any problems, please contact our support via Intercom by logging into your dashboard, or, if you are Enterprise, by contacting your Engagement Manager.
Loading