Python процесс очистки в GCP Compute Engine приостановлен для Crypto Mining - PullRequest
0 голосов
/ 18 февраля 2020

Я получил это письмо, и мой экземпляр виртуальной машины был приостановлен. Это сервер воздушных потоков, который запускает несколько процессов, включая одну группу обеспечения доступности баз данных, которая очищает 5k - 10k отдельных ссылок и извлекает из нее тело - это выполняется одновременно 500 различными соединениями, что, как я подозреваю, поднимает эту конкретную проблему. Я получаю это электронное письмо после 24 часов работы, и моя виртуальная машина приостанавливается.

Dear Developer,
We've detected that your Google Cloud Project is engaging in cryptocurrency mining, resulting in the suspension of all project resources displaying this behavior.

This activity violates the Google Cloud Platform Terms of Service or the Terms of Service of the Google API you may be using.

We recommend that you review this activity to determine if it is intended. Cryptocurrency mining is often an indication of the use of fraudulent accounts and payment instruments, and we require verification in order to mine cryptocurrency on our platform.

Therefore if you wish to continue engaging in cryptocurrency mining, you must apply for an Invoiced Billing Account. Additional information is available in the Cloud Security Help Center.

To regain access to your suspended resources please submit an appeal:

Sign in to as the project owner, click Request an appeal below, and fill in the following details:

Possible trigger of this activity
If the behavior is intentional, please provide the Invoiced Billing Account ID
If you believe the project may have been compromised by a third party, describe your concerns
Learn more about policy violations and appeals

If you need further help, reach out to the Google Cloud Platform Community Support Forum. If you have a support package, file a ticket through the Support Center.

You may have received an earlier warning about a possible suspension of resources if this violation wasn't corrected. If you didn't receive a warning before this suspension, it was because the project's behavior was seriously impacting the service of other users.

Это код, который я подозреваю, создает проблему

out = []
CONNECTIONS = 500
TIMEOUT = 5

def do_request(url):
    try:
        requests.head(url, verify=False, timeout=10, headers=headers)
    except Exception:
        return "", 404

    try:
        res = requests.get(url, verify=False, timeout=10, headers=headers)
        content = extract_content(res.content)
        return content, res.status_code
    except Exception:
        return "", 404


def gen_text_dragnet(article, timeout):
    content, status_code = do_request(article["url"])
    article.update(body=content[:500], status_code=status_code)
    return status_code


def extract_body():
    """
    Processing broken URLs are a huge pain in the ass
    """
    global_init()
    try:
        articles = Article.objects.filter(
            status_code__exists=False)[:5000]
    except Exception as e:
        print(e)
        raise

    print("extracting bodies from {} articles".format(len(articles)))

    with concurrent.futures.ThreadPoolExecutor(max_workers=CONNECTIONS) as executor:
        future_to_url = (executor.submit(gen_text_dragnet, article, TIMEOUT)
                         for article in articles)
        time1 = time.time()
        for future in concurrent.futures.as_completed(future_to_url):
            try:
                data = future.result()
            except Exception as exc:
                data = str(type(exc))
            finally:
                out.append(data)
                print(str(len(out)), end="\r")

        time2 = time.time()

    print(f'Took {time2-time1:.2f} s')
    print(pd.Series(out).value_counts())

Это произошло несколько раз, и каждый раз, когда я подаю апелляцию, я не получаю ответа, и мне приходится удалять и заново создавать экземпляр. Это действительно раздражает и не является устойчивым для проекта. Что я могу с этим поделать?

1 Ответ

1 голос
/ 18 февраля 2020

StackOverflow не подходит для решения подобных проблем.

Лучшим вариантом для вас может стать Служба поддержки Google Cloud , поскольку у них есть возможность проверить ваш проект и предоставить вам дальнейшие инструкции. Если у вас еще нет контракта на поддержку, в таком случае вы можете обратиться за помощью в службу поддержки.

Если вы не хотите обращаться в службу поддержки таким образом, вы можете попробовать открыть дело в Google Issue Tracker в этом частном компоненте и предоставить проект имя, адрес электронной почты и как можно больше деталей.

...