Skip to content

Commit

Permalink
Merge pull request #496 from CertifaiAI/cw_close_classifai
Browse files Browse the repository at this point in the history
🎇 API to terminate classifai
  • Loading branch information
Han Sheng committed Aug 23, 2021
2 parents e170a24 + a88d201 commit 2ccbc2f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ public void start(Promise<Void> promise)

router.delete("/v2/:annotation_type/projects/:project_name/uuids").handler(v2::deleteProjectData);

router.put("/v2/close").handler(v2::closeClassifai);

//*******************************Cloud*******************************

router.put("/v2/:annotation_type/wasabi/projects/:project_name").handler(cloud::createWasabiCloudProject);
Expand Down
24 changes: 24 additions & 0 deletions classifai-core/src/main/java/ai/classifai/router/V2Endpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;

/**
* Classifai v2 endpoints
Expand Down Expand Up @@ -560,6 +561,29 @@ public void selectProjectFolder(RoutingContext context)
HTTPResponseHandler.configureOK(context);
}

/**
* Close/terminate classifai
* PUT http://localhost:{port}/v2/close
*
* Example:
* PUT http://localhost:{port}/v2/close
*/
public void closeClassifai(RoutingContext context)
{
HTTPResponseHandler.configureOK(context);

//terminate after 1 seconds
new java.util.Timer().schedule(
new java.util.TimerTask() {
@Override
public void run() {
System.exit(0);
}
},
1000
);
}

/**
* Get status of choosing a project folder
* GET http://localhost:{port}/v2/folders
Expand Down

0 comments on commit 2ccbc2f

Please sign in to comment.