-- change state of warpRun from goto_cleaned to cleaned or goto_purged to purged
-- when all of the consituant skyfiles are in the end state
-- arguments are new state (cleaned or purged) warp_id and new state again for 
-- the chipProcessedImfile sub query
UPDATE warpRun
    SET state = '%s'
    WHERE
    warpRun.warp_id = %lld
    AND (SELECT
        COUNT(warp_id)
        FROM warpSkyfile
        WHERE
            warpSkyfile.warp_id = warpRun.warp_id
            AND data_state != '%s'
        ) = 0
