-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DPE-2635] Add support for spark-metrics and fix pod template issue (#45
- Loading branch information
Showing
4 changed files
with
227 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: label-test | ||
labels: | ||
product: charmed-spark | ||
spec: | ||
containers: | ||
- name: spark | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Very simple HTTP server in python. | ||
Usage:: | ||
./dummy-web-server.py [<port>] | ||
Send a GET request:: | ||
curl http://localhost | ||
Send a HEAD request:: | ||
curl -I http://localhost | ||
Send a POST request:: | ||
curl -d "foo=bar&bin=baz" http://localhost | ||
""" | ||
import sys | ||
|
||
if sys.version_info[0] < 3: | ||
# python 2 import | ||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | ||
else: | ||
# python 3 import | ||
from http.server import BaseHTTPRequestHandler, HTTPServer | ||
|
||
class BaseServer(BaseHTTPRequestHandler): | ||
def _set_headers(self): | ||
self.send_response(200) | ||
self.send_header('Content-type', 'text/html') | ||
self.end_headers() | ||
|
||
def do_GET(self): | ||
self._set_headers() | ||
print("<html><body><p>hello, world!</p></body></html>".encode('utf-8')) | ||
|
||
def do_HEAD(self): | ||
self._set_headers() | ||
|
||
def do_POST(self): | ||
content_length = int(self.headers['Content-Length']) | ||
post_data = self.rfile.read(content_length) | ||
self._set_headers() | ||
print("%s".encode('utf-8') % post_data) | ||
|
||
def run(server_class=HTTPServer, handler_class=BaseServer, port=9091): | ||
server_address = ('', port) | ||
httpd = server_class(server_address, handler_class) | ||
print('HTTP server running on port %s'% port) | ||
httpd.serve_forever() | ||
|
||
if __name__ == "__main__": | ||
from sys import argv | ||
|
||
if len(argv) == 2: | ||
run(port=int(argv[1])) | ||
else: | ||
run() |