INNER CODE UNIT · Python

parse_procfile

piku/piku · piku.py:280

def parse_procfile(filename):
    """Parses a Procfile and returns the worker types. Only one worker of each type is allowed."""

    workers = {}
    if not exists(filename):
        return None

    with open(filename, 'r') as procfile:
        for line_number, line in enumerate(procfile):
            line = line.strip()
            if line.startswith("#") or not line:
                continue
            try:
                kind, command = map(lambda x: x.strip(), line.split(":", 1))
                # Check for cron patterns
                if kind.startswith("cron"):
                    limits = [59, 24, 31, 12, 7]
                    res = match(CRON_REGEXP, command)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…