Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AL-128: Replace StringTable where feasible #3

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions assemblyline_service_client/task_handler.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
import copy
import json
import os
import requests
import select
import shutil
import signal
import tempfile
import time
import yaml
from enum import Enum
from json import JSONDecodeError
from typing import Optional

import requests
import yaml

from assemblyline.common.digests import get_sha256_for_file
from assemblyline.common.str_utils import StringTable
from assemblyline.odm.messages.task import Task as ServiceTask
from assemblyline.odm.models.service import Service
from assemblyline_core.server_base import ServerBase

STATUSES = StringTable('STATUSES', [
('INITIALIZING', 0),
('WAITING_FOR_TASK', 1),
('DOWNLOADING_FILE', 2),
('DOWNLOADING_FILE_COMPLETED', 3),
('PROCESSING', 4),
('RESULT_FOUND', 5),
('ERROR_FOUND', 6),
('STOPPING', 7),
])

class STATUSES(Enum):
INITIALIZING = 0
WAITING_FOR_TASK = 1
DOWNLOADING_FILE = 2
DOWNLOADING_FILE_COMPLETED = 3
PROCESSING = 4
RESULT_FOUND = 5
ERROR_FOUND = 6
STOPPING = 7

SHUTDOWN_SECONDS_LIMIT = 10
DEFAULT_API_KEY = 'ThisIsARandomAuthKey...ChangeMe!'
Expand Down