Skip to content

Commit 6a0dbc4

Browse files
jonathanfeng-scalerodscalautarorangilfatihkurtoglu
authored
studio-api (#63)
* starter * hash * small updates * remove unneeded paginator * typo * draft new methods * str -> arr of str * return dict for method is ok like this? * small fixes from testing * tests and fixes * formatting * pythonblack reformat * more formatting * Update .pylintrc * Update test_client.py * Update test_client.py * comments for pylint * add studio api documentation * bump version number * title underlining * small version edit * typo Co-authored-by: Fatih Kurtoglu <fatih.kurtoglu@scale.com> * typos Co-authored-by: Fatih Kurtoglu <fatih.kurtoglu@scale.com> * typos Co-authored-by: Fatih Kurtoglu <fatih.kurtoglu@scale.com> * fixes * formatting * Update __init__.py * better test cases * last_tests * remove broken test * formatting * formatting Co-authored-by: Rodrigo Soriano <rodrigo.soriano@scale.com> Co-authored-by: Lautaro Rangil <lautaro.rangil@scale.com> Co-authored-by: Fatih Kurtoglu <fatih.kurtoglu@scale.com>
1 parent 55c52c2 commit 6a0dbc4

File tree

8 files changed

+725
-3
lines changed

8 files changed

+725
-3
lines changed

.pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ disable=
77
too-many-arguments,
88
too-many-instance-attributes,
99
invalid-name,
10+
too-many-lines, # __init__.py is > 1000 lines

README.rst

Lines changed: 179 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,49 @@ The attribute can be passed to the task payloads, in the ``attachment`` paramete
546546
...
547547
...
548548
)
549+
550+
Manage Teammates
551+
________________
552+
553+
Manage the members of your Scale team via API. Check out `Scale Team API Documentation`__ for more information.
554+
555+
__ https://docs.scale.com/reference/teams-overview
556+
557+
List Teammates
558+
^^^^^^^^^^^^^^
559+
560+
Lists all teammates in your Scale team.
561+
Returns all teammates in a List of Teammate objects.
562+
563+
.. code-block:: python
564+
565+
teammates = client.list_teammates()
566+
567+
Invite Teammate
568+
^^^^^^^^^^^^^^^
569+
570+
Invites a list of email strings to your team with the provided role.
571+
The available teammate roles are: 'labeler', 'member', or 'manager'.
572+
Returns all teammates in a List of Teammate objects.
573+
574+
.. code-block:: python
575+
576+
from scaleapi import TeammateRole
577+
578+
teammates = client.invite_teammates(['email1@example.com', 'email2@example.com'], TeammateRole.Member)
579+
580+
Update Teammate Role
581+
^^^^^^^^^^^^^^^^^^^^^
582+
583+
Updates a list of emails of your Scale team members with the new role.
584+
The available teammate roles are: 'labeler', 'member', or 'manager'.
585+
Returns all teammates in a List of Teammate objects.
586+
587+
.. code-block python
588+
589+
from scaleapi import TeammateRole
590+
591+
teammates = client.update_teammates_role(['email1@example.com', 'email2@example.com'], TeammateRole.Manager)
549592
550593
Example Scripts
551594
_______________
@@ -633,6 +676,139 @@ Create a training task.
633676
634677
client.create_training_task(TaskType, ...task parameters...)
635678
679+
Studio Assignments (For Scale Studio only)
680+
__________________________________________
681+
682+
Manage project assignments for your labelers.
683+
684+
List All Assignments
685+
^^^^^^^^^^^^^^^^^^^^
686+
687+
Lists all your Scale team members and the projects they are assigned to.
688+
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.
689+
690+
.. code-block:: python
691+
692+
assignments = client.list_studio_assignments()
693+
my_assignment = assignments.get('my-email@example.com')
694+
695+
Add Studio Assignment
696+
^^^^^^^^^^^^^^^^^^^^^
697+
698+
Assigns provided projects to specified teammate emails.
699+
700+
Accepts a list of emails and a list of projects.
701+
702+
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.
703+
704+
.. code-block:: python
705+
706+
assignments = client.add_studio_assignments(['email1@example.com', 'email2@example.com'], ['project 1', 'project 2'])
707+
708+
709+
Remove Studio Assignment
710+
^^^^^^^^^^^^^^^^^^^^^^^^
711+
712+
Removes provided projects from specified teammate emails.
713+
714+
Accepts a list of emails and a list of projects.
715+
716+
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.
717+
718+
.. code-block:: python
719+
720+
assignments = client.remove_studio_assignments(['email1@example.com', 'email2@example.com'], ['project 1', 'project 2'])
721+
722+
Studio Project Groups (For Scale Studio Only)
723+
_____________________________________________
724+
725+
Manage groups of labelers in our project by using Studio Project Groups.
726+
727+
List Studio Project Groups
728+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
729+
730+
Returns all labeler groups for the specified project.
731+
732+
.. code-block:: python
733+
734+
list_project_group = client.list_project_groups('project_name')
735+
736+
Add Studio Project Group
737+
^^^^^^^^^^^^^^^^^^^^^^^^
738+
739+
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.
740+
741+
Returns the created StudioProjectGroup object.
742+
743+
.. code-block:: python
744+
745+
added_project_group = client.create_project_group(
746+
'project_name', ['email1@example.com'], 'project_group_name'
747+
)
748+
749+
Update Studio Project Group
750+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
751+
752+
Assign or remove teammates from a project group.
753+
754+
Returns the updated StudioProjectGroup object.
755+
756+
.. code-block:: python
757+
758+
updated_project_group = client.update_project_group(
759+
'project_name', 'project_group_name', ['emails_to_add'], ['emails_to_remove']
760+
)
761+
762+
Studio Batches (For Scale Studio Only)
763+
_______________________________________
764+
765+
Get information about your pending Studio batches.
766+
767+
List Studio Batches
768+
^^^^^^^^^^^^^^^^^^^
769+
770+
Returns a list of StudioBatch objects for all pending Studio batches.
771+
772+
.. code-block:: python
773+
774+
studio_batches = client.list_studio_batches()
775+
776+
Assign Studio Batches
777+
^^^^^^^^^^^^^^^^^^^^^^
778+
779+
Sets labeler group assignment for the specified batch.
780+
781+
Returns a StudioBatch object for the specified batch.
782+
783+
.. code-block:: python
784+
785+
assigned_studio_batch = client.assign_studio_batches('batch_name', ['project_group_name'])
786+
787+
Set Studio Batches Priority
788+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
789+
790+
Sets the order to prioritize your pending Studio batches. You must include all pending studio batches in the List.
791+
792+
Returns a List of StudioBatch objects in the new order.
793+
794+
.. code-block:: python
795+
796+
studio_batch_priority = client.set_studio_batches_priorities(
797+
['pending_batch_1', 'pending_batch_2', 'pending_batch_3']
798+
)
799+
800+
Reset Studio Batches Priority
801+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
802+
803+
Resets the order of your Studio batches to the default order, which prioritizes older batches first.
804+
805+
Returns a List of StudioBatch objects in the new order.
806+
807+
.. code-block:: python
808+
809+
reset_studio_batch_prioprity = client.reset_studio_batches_priorities()
810+
811+
636812
Error handling
637813
______________
638814

@@ -663,7 +839,9 @@ For example:
663839
print(err.code) # 400
664840
print(err.message) # Parameter is invalid, reason: "attachments" is required
665841
842+
843+
666844
Troubleshooting
667845
_______________
668846

669-
If you notice any problems, please email us at support@scale.com.
847+
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.

0 commit comments

Comments
 (0)