<commit_before>const request = require('request')
const VError = require('verror')
const HttpError = require('../errors/http')
const util = require('util')

function Marathon(host, port, pathPrefix) {
	this.url = util.format(
		'http://%s%s%s/v2',
		host,
		port ? ':' + port : '',
		pathPrefix || ''
	)
}

function toApp(marathonApp) {
	return {
		"name": marathonApp.id,
		"instances": {
			"requested": marathonApp.instances,
			"running": marathonApp.tasksRunning,
			"healthy": marathonApp.tasksHealthy
		}
	}
}


function newApp(appName, instances) {
	return {
		"id": appName,
		"container": {
			"type": "DOCKER",
			"docker": {
				"image": "nginx:1.9.4",
				"network": "BRIDGE",
				"portMappings": [
					{
						"containerPort": 80,
						"hostPort": 0,
						"protocol": "tcp"
					}
				]
			}
		},
		"instances": instances,
		"cpus": 0.1,
		"mem": 16,
		"healthChecks": [
			{
				"protocol": "TCP",
				"gracePeriodSeconds": 60,
				"intervalSeconds": 1,
				"portIndex": 0,
				"timeoutSeconds": 1,
				"maxConsecutiveFailures": 30
			}
		]
	}
}

// get details about all apps
Marathon.prototype.apps = function() {
	var url = util.format('%s/apps?embed=apps.counts', this.url)
	console.log(util.format('marathon apps request: %s', url))
	return new Promise(function(resolve, reject) {
		request.get(url, function (err, res, body) {
			if (err) {
				reject(new VError(err, 'marathon apps request error'))
				return
			}
			if (res.statusCode < 200 || res.statusCode >= 400) {<commit_msg>Minimize resource allocation of the nginx container<commit_after>const request = require('request')
const VError = require('verror')
const HttpError = require('../errors/http')
const util = require('util')

function Marathon(host, port, pathPrefix) {
	this.url = util.format(
		'http://%s%s%s/v2',
		host,
		port ? ':' + port : '',
		pathPrefix || ''
	)
}

function toApp(marathonApp) {
	return {
		"name": marathonApp.id,
		"instances": {
			"requested": marathonApp.instances,
			"running": marathonApp.tasksRunning,
			"healthy": marathonApp.tasksHealthy
		}
	}
}


function newApp(appName, instances) {
	return {
		"id": appName,
		"container": {
			"type": "DOCKER",
			"docker": {
				"image": "nginx:1.9.4",
				"network": "BRIDGE",
				"portMappings": [
					{
						"containerPort": 80,
						"hostPort": 0,
						"protocol": "tcp"
					}
				]
			}
		},
		"instances": instances,
		"cpus": 0.01,
		"mem": 8,
		"healthChecks": [
			{
				"protocol": "TCP",
				"gracePeriodSeconds": 60,
				"intervalSeconds": 1,
				"portIndex": 0,
				"timeoutSeconds": 1,
				"maxConsecutiveFailures": 30
			}
		]
	}
}

// get details about all apps
Marathon.prototype.apps = function() {
	var url = util.format('%s/apps?embed=apps.counts', this.url)
	console.log(util.format('marathon apps request: %s', url))
	return new Promise(function(resolve, reject) {
		request.get(url, function (err, res, body) {
			if (err) {
				reject(new VError(err, 'marathon apps request error'))
				return
			}
			if (res.statusCode < 200 || res.statusCode >= 400) {
{'fraction_non_alphanumeric': 0.1743119266055046, 'fraction_numerical': 0.015727391874180863, 'mean_word_length': 3.367668097281831, 'pattern_counts': {'":': 50, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3905160', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1094, 'n_words': 234}