<commit_before>#!/usr/bin/python3
#
# Define containerized environment for running Diosix on Qemu
#
# On Google Cloud Run: Creates HTTP server on port 8080
# or whatever was specified using the PORT system variable.
# Outputs via the HTTP port. This requires K_SERVICE to be set.
#
# On all other environments: Log to stdout
#
# syntax: entrypoint.py <command>
#
# Author: <NAME> <<EMAIL>>
#

import os
import sys

global command_result

from flask import Flask

if __name__ == "__main__":
    if (os.environ.get('K_SERVICE')) != '':
        print('Running HTTP service for Google Cloud')
        # app = Flask(__name__)
        # @app.route('/')
        # def ContainerService():
        #   return 'Container built. Use docker images and docker run in the Google Cloud shell to run this container.\n'
        # app.run(debug=True,host='0.0.0.0',port=int(os.environ.get('PORT', 8080)))
    else:
        print('Running locally')
        # stream = os.popen('. $HOME/.cargo/env && cd /build/diosix && {}'.format(' '.join(sys.argv[1:])))
        # output = stream.read()
        # output<commit_msg>Debug Google Cloud Run support<commit_after>#!/usr/bin/python3
#
# Define containerized environment for running Diosix on Qemu
#
# On Google Cloud Run: Creates HTTP server on port 8080
# or whatever was specified using the PORT system variable.
# Outputs via the HTTP port. This requires K_SERVICE to be set.
#
# On all other environments: Log to stdout
#
# syntax: entrypoint.py <command>
#
# Author: <NAME> <<EMAIL>>
#

import os
import sys

global command_result

from flask import Flask

if __name__ == "__main__":
    print('{} {} {}', os.environ.get('K_SERVICE'), os.environ.get('K_REVISION'), os.environ.get('K_CONFIGURATION'))

    if (os.environ.get('K_SERVICE')) != '':
        print('Running HTTP service for Google Cloud')
        # app = Flask(__name__)
        # @app.route('/')
        # def ContainerService():
        #   return 'Container built. Use docker images and docker run in the Google Cloud shell to run this container.\n'
        # app.run(debug=True,host='0.0.0.0',port=int(os.environ.get('PORT', 8080)))
    else:
        print('Running locally')
        # stream = os.popen('. $HOME/.cargo/env && cd /build/diosix && {}'.format(' '.join(sys.argv[1:])))
        # output = stream.read()
        # output
{'fraction_non_alphanumeric': 0.13948497854077252, 'fraction_numerical': 0.01201716738197425, 'mean_word_length': 3.2381818181818183, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1916315', 'n_tokens_mistral': 732, 'n_tokens_neox': 720, 'n_words': 229}