Skip to content

Commit

Permalink
Merge pull request #174 from apriltuesday/EVA-3689
Browse files Browse the repository at this point in the history
EVA-3689: Increase connectTimeoutMS for mongoexport
  • Loading branch information
apriltuesday authored Oct 23, 2024
2 parents eda870c + ce850d1 commit f13cf61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 0 additions & 2 deletions accession-monitoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import configparser
import logging
import os
import subprocess
import sys

Expand Down Expand Up @@ -56,7 +55,6 @@ def run_command_with_output(command_description, command, return_process_output=
process_output = ""

logger.info("Starting process: " + command_description)
logger.info("Running command: " + command)

with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1, universal_newlines=True,
shell=True) as process:
Expand Down
26 changes: 16 additions & 10 deletions accession-monitoring/monitor_duplicate_accessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import click
from datetime import datetime
import getpass
import os
import smtplib
from __init__ import *
from datetime import datetime
from urllib.parse import quote_plus

import click

from __init__ import *


def get_mongo_uri(mongo_connection_properties):
return "mongodb://{0}:{1}@{2}/{3}?authSource={4}".format(mongo_connection_properties["mongo_username"],
quote_plus(mongo_connection_properties["mongo_password"]),
mongo_connection_properties["mongo_host"],
mongo_connection_properties["mongo_db"],
mongo_connection_properties["mongo_auth_db"])
def get_mongo_uri(mongo_connection_properties, timeout=60000):
return "mongodb://{0}:{1}@{2}/{3}?authSource={4}&connectTimeoutMS={5}".format(
mongo_connection_properties["mongo_username"],
quote_plus(mongo_connection_properties["mongo_password"]),
mongo_connection_properties["mongo_host"],
mongo_connection_properties["mongo_db"],
mongo_connection_properties["mongo_auth_db"],
timeout
)


def export_mongo_accessions(mongo_connection_properties, collection_name, export_output_filename):
export_command = 'mongoexport --uri {0} ' \
export_command = 'mongoexport --uri "{0}" ' \
'--collection {1} --type=csv --fields accession ' \
"--query '{{\"remappedFrom\": {{\"$exists\": false}}}}' " \
'-o "{2}" 2>&1' \
Expand Down

0 comments on commit f13cf61

Please sign in to comment.