-- handle changes in warpSkyfile.data_state.
-- Used for the modes tocleanedskyfile and topurgedskyfile
-- args are new data_state, warp_id, skycell_id and current expected state for warpRun
UPDATE warpSkyfile
    SET 
    data_state = '%s'
WHERE
    warp_id = %lld
    AND skycell_id = '%s'
    -- only update if chipRun.state has the expected value
    AND (
        SELECT state from warpRun where warpRun.warp_id = warpSkyfile.warp_id
    ) = '%s'
    

