Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Validate Idempotent Linux Task Runner

Easy
CodingHash TablesArraysStringsAsked 1 times

Problem

Given a list of Linux automation task results, implement a function that determines whether the automation run is safe and repeatable. Each task is represented as a dictionary with keys name, changed, rc, and check_rc, where changed is a boolean indicating whether the task modified the system, rc is the normal execution return code, and check_rc is the dry-run return code. Return True if every task succeeded in both modes and at least one task is idempotent, meaning its dry-run and normal execution agree on whether a change is needed; otherwise return False.

Constraints

  • 1 <= len(tasks) <= 10^4
  • Each task contains keys: name, changed, rc, check_rc
  • rc and check_rc are integers in the range [-255, 255]

Function Signature

def validate_task_run(tasks):

You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.

Sign up freeI have an account
def solve(rows):
    counts = {}
    for row in rows:
        ...
    return result
Sign up to unlock solutions
Lyft DevOps Engineer Interview Questions
Next questions
Sun LifeIdempotent Automation ScriptsMediumOpenAIIdempotent Automation for Infrastructure ChangesMediumTaskRabbitIdempotent Pipelines for Safe RerunsMedium
Python 3.10