Key Information

Register
Submit
The challenge is finished.

Challenge Overview

Welcome to Topcoder Submission - Marathon Match Java Score System - Statistics Functionality.

Contest Details

We are creating a new processor to handle Marathon Matches challenges based on NodeJs 8.x.

We have already created the scoring system for Java - http://www.topcoder.com/challenge-details/30072473/?type=develop&noncache=true. However we need to add some statistics to the verification process.

Project Background
 
  • Topcoder is updating its api and one of the apis being updated is the Submission api.
  • One of the scenarios that we are taking care of here is that when a user uploads a submission to Topcoder for a Marathon Match challenge.
  • An app (not relevant for this contest) creates a message that contains details about this submission and sends it to an Apache Kafka instance.
  • This will be a challenge among a series of challenge that will build the Marathon Match processor.

Technology Stack
 
  • Nodejs
  • Kafka
  • Java

Individual Requirements

We are extending the existing Marathon Match Java Score System to collect statistics during the verification process. Please check here the specifications of the previous challenge for more details. We are also making some fixes to the existing code.

1. The workflow for the Marathon Match Java Score System is shown below:



2. During the execution of the Java method provided by member we need to collect the following statistics:

a) Maximum memory allocated during method execution.

b) Total Execution time.


3. The Verification table has a parameter called maxMemory which is the max memory allocated for JVM. This parameter is being set in the JVM options during node-java library initialization in verifySubmission method. We need to catch any Out Of Memory exception during execution of the method.

table name = Verification

{
   "id": "<uuid - the verification id>",
   "challengeId": "<challenge id>",
   "className": <the class name used Java code>",
   "methods": [
         {
               "name": "aMethod", // the method should be public in class
               "input": [ "int" ] // inputs of different types (like String, int, double, String[], int[], double[])
               "output": "int" // output of different types (like String, int, double, String[], int[], double[])
         }
   ],
   "maxMemory": "64m",
   "inputs": [ // required
       [ 0 ],
       [ 1 ],
       [ 2 ]
   ],
   "outputs": [ // optional
       0,
       0,
       0
   ],
   "url": "<an url with the verification code>"
}

4. The Job will need to hold the score information for each input along with the statistics. If a global error occurs (method has wrong signature), status should be marked as Error and results will be null. If an error occurs during method execution for a specific input, the error should be placed inside the object. In this case the score for that input will be 0.0 and all other values will be -1. See below:

table name= Job
{
  "id": "<uuid - the job id>",
  "submissionId": "<submission id from kafka bus>",
  "challengeId": "<challenge id from kafka bus>",
  "memberId": "<member id from kafka bus>",
  "status": "<Start | Compile | Verification | Finished | Error",
  "error": "<global error>",
  "results": [
     {
         "error": "<an error>",
         "score": 10.0, // score for input[0]
         "memory": 1024, // KBytes
         "executionTime": 1000 // milliseconds
     },
     {
         "error": "<an error>",
         "score": 13.0, // score for input[1]
         "memory": 1024, // KBytes
         "executionTime": 1000 // milliseconds
     },
     {
         "error": "<an error>",
         "score": 13.0, // score for input[2]
         "memory": 1024, // KBytes
         "executionTime": 1000 // milliseconds
     }
  ]
}

5. The idea is to create a Wrapper class that will extend from the member class and will do all the statistics calculations and provide a method for getting the information to the javascript code. Also, it will need to catch any out of memory error and provide the appropriate error to javascript code.

6. The wrapper class must have two public methods that will return memory usage and running time.

7. There is no hard requirements on how to calculate the statistics. For memory, we suggest using java.lang.management classes. Runtime must be calculated in milliseconds.

8. Add e2e testing using the solution provided in existing code - please follow the instructions in documentation to setup DynamoDB and S3. Use your AWS credentials to run the tests.

a) use the following message in Kafka. Change url to match your S3 bucket:

{
  "topic": "submission.notification.create",
  "originator": "submission-api",
  "timestamp": "2018-10-03T16:36:57.524Z",
  "mime-type": "some mime-type",
  "payload": {
    "resource": "submission",
    "id": "some-id",
    "challengeId": "16344",
    "memberId": "123457",
    "url": "https://s3.amazonaws.com/tc-development-bucket/Random.java",
    "fileType": "java",
    "isFileSubmission": true
  }
}

b) check the DB status of the job id is equal to Finished for success.


9. All tests (unit and e2e) must work without any errors.
 

Deployment guide and validation document


You will need to update the deployment guide (README.md) and validation document (Validation.md).


The README.md must show how to:

  • Configure and Build application

The Validation.md must show all the steps necessary to verify the application with the new changes:
  • Verify the code for different test cases


Final Submission Guidelines

  • Updated code
  • Required Documentation

ELIGIBLE EVENTS:

Topcoder Open 2019

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30072934