World Conquest Chronicles

World Conquest Chronicles

go-exercises-worker, v1.1

Background worker of the service for solving programming exercises.

Canceling the code execution by a timeout in the solution runner based on the github.com/thewizardplusplus/go-code-runner package.

Change Log

Features

  • interaction with queues:
    • common properties:
      • automatic declaring of the used queues;
      • passing of a message data in JSON;
    • operations:
      • consuming of the solutions:
        • concurrent handling;
        • once requeue the solution on failure;
      • producing of the solution results;
  • solution runners:
    • dummy solution runner (returns the current timestamp as the result);
    • solution runner based on the github.com/thewizardplusplus/go-code-runner package:
      • loading of the allowed imports from an outer configuration;
      • canceling the code execution by a timeout.

Usage

$ go-exercises-backend

Environment variables:

  • ALLOWED_IMPORT_CONFIG — path to the allowed import config (default: ./configs/allowed_imports.json);
  • RUNNING_TIMEOUT — maximal duration of solution running (default: 10s);
  • MESSAGE_BROKER_ADDRESSRabbitMQ connection URI (default: amqp://rabbitmq:rabbitmq@localhost:5672);
  • SOLUTION_CONSUMER_BUFFER_SIZE — solution consumer channel capacity (default: 1000);
  • SOLUTION_CONSUMER_CONCURRENCY — amount of solution consumer threads (default: 1000).

Repository

Link: https://github.com/thewizardplusplus/go-exercises-worker/tree/v1.1.

Content: code.

License: MIT.