networking permissions update

This commit is contained in:
Abubakar Abid 2019-02-19 02:31:31 -08:00
parent a553ed60cd
commit 251e703bf2
2 changed files with 73 additions and 42 deletions

103
.idea/workspace.xml generated
View File

@ -2,7 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="fd73cd66-e80f-470e-a2ec-e220d3b6b864" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/setup.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gradio/networking.py" beforeDir="false" afterPath="$PROJECT_DIR$/gradio/networking.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -75,7 +76,7 @@
<entry key="html" value="4" />
<entry key="ipynb" value="1" />
<entry key="js" value="5" />
<entry key="py" value="18" />
<entry key="py" value="19" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
@ -85,7 +86,7 @@
<entry key="IPNB" value="1" />
<entry key="JavaScript" value="5" />
<entry key="PLAIN_TEXT" value="1" />
<entry key="Python" value="18" />
<entry key="Python" value="19" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
@ -95,7 +96,7 @@
<entry key="gitignore" value="2" />
<entry key="html" value="112" />
<entry key="js" value="272" />
<entry key="py" value="4443" />
<entry key="py" value="4449" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
@ -104,18 +105,18 @@
<entry key="HTML" value="112" />
<entry key="JavaScript" value="272" />
<entry key="PLAIN_TEXT" value="21" />
<entry key="Python" value="4443" />
<entry key="Python" value="4449" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/setup.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="7" column="18" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
<caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
</state>
</provider>
</entry>
@ -123,8 +124,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/gradio/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1750">
<caret line="70" selection-start-line="70" selection-end-line="70" />
<state relative-caret-position="175">
<caret line="124" column="11" lean-forward="true" selection-start-line="124" selection-start-column="11" selection-end-line="124" selection-end-column="11" />
<folding>
<element signature="e#0#14#0" expanded="true" />
<marker date="1550570423744" expanded="true" signature="2592:2837" ph="..." />
@ -136,8 +137,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/gradio/inputs.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1366">
<caret line="66" selection-start-line="66" selection-end-line="66" />
<state relative-caret-position="291">
<caret line="23" column="12" selection-start-line="23" selection-start-column="12" selection-end-line="23" selection-end-column="12" />
<folding>
<element signature="e#0#35#0" expanded="true" />
</folding>
@ -146,10 +147,25 @@
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/../testing/test_gradio.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="7" column="9" selection-start-line="7" selection-end-line="7" selection-end-column="14" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/gradio/networking.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="22">
<caret line="6" column="11" selection-start-line="6" selection-start-column="5" selection-end-line="6" selection-end-column="11" />
<state relative-caret-position="472">
<caret line="68" selection-start-line="68" selection-end-line="68" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -257,6 +273,8 @@
<option value="$PROJECT_DIR$/gradio/inputs.py" />
<option value="$PROJECT_DIR$/gradio/__init__.py" />
<option value="$PROJECT_DIR$/setup.py" />
<option value="$PROJECT_DIR$/../testing/test_gradio.py" />
<option value="$PROJECT_DIR$/gradio/networking.py" />
</list>
</option>
</component>
@ -562,23 +580,6 @@
<entry file="file://$PROJECT_DIR$/gradio/preprocessing_utils.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/gradio/inputs.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1366">
<caret line="66" selection-start-line="66" selection-end-line="66" />
<folding>
<element signature="e#0#35#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gradio/networking.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="22">
<caret line="6" column="11" selection-start-line="6" selection-start-column="5" selection-end-line="6" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gradio/outputs.py">
<provider selected="true" editor-type-id="text-editor">
<state>
@ -588,13 +589,22 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gradio/__init__.py">
<entry file="file://$PROJECT_DIR$/gradio/inputs.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1750">
<caret line="70" selection-start-line="70" selection-end-line="70" />
<state relative-caret-position="291">
<caret line="23" column="12" selection-start-line="23" selection-start-column="12" selection-end-line="23" selection-end-column="12" />
<folding>
<element signature="e#0#14#0" expanded="true" />
<marker date="1550570423744" expanded="true" signature="2592:2837" ph="..." />
<element signature="e#0#35#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../testing/test_gradio.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="7" column="9" selection-start-line="7" selection-end-line="7" selection-end-column="14" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
@ -602,7 +612,28 @@
<entry file="file://$PROJECT_DIR$/setup.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="7" column="18" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
<caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gradio/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="124" column="11" lean-forward="true" selection-start-line="124" selection-start-column="11" selection-end-line="124" selection-end-column="11" />
<folding>
<element signature="e#0#14#0" expanded="true" />
<marker date="1550570423744" expanded="true" signature="2592:2837" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gradio/networking.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="472">
<caret line="68" selection-start-line="68" selection-end-line="68" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state>
</provider>
</entry>

View File

@ -66,11 +66,11 @@ def setup_ngrok(local_port, api_url=NGROK_TUNNELS_API_URL):
def kill_processes(process_ids):
for proc in process_iter():
for conns in proc.connections(kind='inet'):
if conns.laddr.port in process_ids:
try:
proc.send_signal(SIGTERM) # or SIGKILL
except AccessDenied:
print("Unable to kill process running on port {}, please kill manually.".format(conns.laddr.port))
try:
for conns in proc.connections(kind='inet'):
if conns.laddr.port in process_ids:
proc.send_signal(SIGTERM) # or SIGKILL
except AccessDenied:
print("Unable to kill process running on port {}, please kill manually.".format(conns.laddr.port))