Shop - GateNLP/cloud-client GitHub Wiki

The class uk.ac.gate.cloud.shop.Shop is the main entry point if you want to

  • programmatically browse the pipelines and machines that are available on the GATE Cloud platform or
  • reserve an annotation job based on a specific pipeline or a machine of a specific type.

Creating a client

To create a client instance you need your API key ID and password - if you do not have an API key you can generate one from your account page on the GATE Cloud website. You will need to enable the "reserve jobs & servers" permission for the API key.

Shop shop = new Shop("<key id>", "<password>");

Accessing items

To get a list of all available shop items you can use the listItems() method. You can filter the list of items by passing tag values, just as you can when viewing the shop interface on the website.

List<Item> items = shop.listItems("English");

To fetch a single specific item you can use the getItem method, which takes a shop item ID.

Item item = shop.getItem(2);

Reserving annotation jobs & machines

Once you have an Item you can use the reserve methods to reserve one or more annotation jobs based on that pipeline or machines of that type, as appropriate.

Job job = item.reserve();

The Job class is discussed in more detail on the job management page. If the selected item is not a pipeline (e.g. it is a Mímir server) then the reservation operation will succeed but the reserve method will return null or an empty list.

⚠️ **GitHub.com Fallback** ⚠️