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

[Core] Remove backward compatibility code for 0.6.0 & 0.7.0 #4175

Merged
merged 7 commits into from
Oct 28, 2024

Conversation

cblmemo
Copy link
Collaborator

@cblmemo cblmemo commented Oct 25, 2024

Try to remve backward compatibility code for 0.6.0 & 0.7.0

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@cblmemo cblmemo modified the milestones: 7.0, v0.7 Oct 25, 2024
@cg505
Copy link
Collaborator

cg505 commented Oct 25, 2024

I pushed a commit that should cover the 0.7.0 removals.

Copy link
Collaborator

@romilbhardwaj romilbhardwaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cblmemo and @cg505! @cblmemo, could you help test this PR with relevant smoke tests + backward compatibility tests?

sky/serve/serve_state.py Outdated Show resolved Hide resolved
@@ -34,7 +34,7 @@ def _get_db_path() -> str:
def create_table(cursor: 'sqlite3.Cursor', conn: 'sqlite3.Connection') -> None:
"""Creates the service and replica tables if they do not exist."""

# auto_restart column is deprecated.
# auto_restart adn requested_resources column is deprecated.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also remove the auto_restart and requested_resources columns when creating the table?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would break the logic here:

def _get_service_from_row(row) -> Dict[str, Any]:
(current_version, name, controller_job_id, controller_port,
load_balancer_port, status, uptime, policy, _, requested_resources,
requested_resources_str, _, active_versions) = row[:13]
return {
'name': name,
'controller_job_id': controller_job_id,
'controller_port': controller_port,
'load_balancer_port': load_balancer_port,
'status': ServiceStatus[status],
'uptime': uptime,
'policy': policy,
# The version of the autoscaler/replica manager are on. It can be larger
# than the active versions as the load balancer may not consider the
# latest version to be active for serving traffic.
'version': current_version,
# The versions that is active for the load balancer. This is a list of
# integers in json format. This is mainly for display purpose.
'active_versions': json.loads(active_versions),
# TODO(tian): Backward compatibility.
# Remove after 2 minor release, 0.6.0.
'requested_resources': pickle.loads(requested_resources)
if requested_resources is not None else None,
'requested_resources_str': requested_resources_str,
}

I think managed spot also keeps those columns for similar reasons:

# === Database schema ===
# `spot` table contains all the finest-grained tasks, including all the
# tasks of a managed job (called spot for legacy reason, as it is generalized
# from the previous managed spot jobs). All tasks of the same job will have the
# same `spot_job_id`.
# The `job_name` column is now deprecated. It now holds the task's name, i.e.,
# the same content as the `task_name` column.
# The `job_id` is now not really a job id, but a only a unique
# identifier/primary key for all the tasks. We will use `spot_job_id`
# to identify the spot job.
# TODO(zhwu): schema migration may be needed.
_CURSOR.execute("""\
CREATE TABLE IF NOT EXISTS spot (
job_id INTEGER PRIMARY KEY AUTOINCREMENT,
job_name TEXT,
resources TEXT,
submitted_at FLOAT,
status TEXT,
run_timestamp TEXT CANDIDATE KEY,
start_at FLOAT DEFAULT NULL,
end_at FLOAT DEFAULT NULL,
last_recovered_at FLOAT DEFAULT -1,
recovery_count INTEGER DEFAULT 0,
job_duration FLOAT DEFAULT 0,
failure_reason TEXT,
spot_job_id INTEGER,
task_id INTEGER DEFAULT 0,
task_name TEXT)""")
_CONN.commit()

cblmemo and others added 2 commits October 25, 2024 12:30
Co-authored-by: Romil Bhardwaj <romil.bhardwaj@berkeley.edu>
@cblmemo cblmemo changed the title [Core] Remove backward compatibility code for 0.6.0 [Core] Remove backward compatibility code for 0.6.0 & 0.7.0 Oct 25, 2024
@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 25, 2024

Also removed several other backward compatibility items. PTAL. Running tests now

@cg505
Copy link
Collaborator

cg505 commented Oct 25, 2024

@cblmemo I did not remove the ones that said "after 0.7.0" since I assume that meant they should be kept in for 0.7.0 and removed for the next release. @Michaelvll @romilbhardwaj what did you intend here?

@romilbhardwaj
Copy link
Collaborator

Thanks @cblmemo and @cg505. I think it's fine to remove those which said "after 0.7.0" - the intent was "in 0.7.0". We should be more specific in our comments in the future.

One quick note @cblmemo - for using facing APIs that we are removing (auto_restart, qps_upper_threshold, qps_lower_threshold and instance_tags in config.yaml), can we add a quick error message that these fields have been removed (and suggest alternatives, e.g., using labels instead of instance_tags)?

@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 25, 2024

Thanks @cblmemo and @cg505. I think it's fine to remove those which said "after 0.7.0" - the intent was "in 0.7.0". We should be more specific in our comments in the future.

One quick note @cblmemo - for using facing APIs that we are removing (auto_restart, qps_upper_threshold, qps_lower_threshold and instance_tags in config.yaml), can we add a quick error message that these fields have been removed (and suggest alternatives, e.g., using labels instead of instance_tags)?

SG! QQ: Does those error messages also need to be removed after 2 minor release, eg. 0.9.0?

@romilbhardwaj
Copy link
Collaborator

Probably not after 2 minor releases - removal messages should stay for some time. If we can have them tracked in a dictionary (e.g., something like removed_fields) along with a comment which version they were removed in (e.g., v0.7.0), then we can manually decide when to remove them.

@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 25, 2024

Thanks @cblmemo and @cg505. I think it's fine to remove those which said "after 0.7.0" - the intent was "in 0.7.0". We should be more specific in our comments in the future.

One quick note @cblmemo - for using facing APIs that we are removing (auto_restart, qps_upper_threshold, qps_lower_threshold and instance_tags in config.yaml), can we add a quick error message that these fields have been removed (and suggest alternatives, e.g., using labels instead of instance_tags)?

Oh actually, those serve related interface have been disabled for 2 minor versions (and suggested to change to other API), and the part of code I removed is exactly those "quick error message", so I think it is the time to remove those quick error msg now? Not sure about the instance tags though.

@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 25, 2024

We could discuss on whether to remove those API or not in this release :)

@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 25, 2024

I tried backward compatibility tests and found an error on latest master - issued in #4179. @romilbhardwaj did you encountered similar behaviour before? Edited: Fixed in #4178. Will try running those tests again after #4178 is merged.

@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 25, 2024

TODO: revert instance_tag and move to 0.8.0

Copy link
Collaborator

@romilbhardwaj romilbhardwaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cblmemo and @cg505! lgtm. @cblmemo, please merge after tests pass.

@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 28, 2024

Thanks @cblmemo and @cg505! lgtm. @cblmemo, please merge after tests pass.

Thanks @romilbhardwaj ! The backward compatibility test just passed. Do you think we need smoke test as well?

@cblmemo cblmemo added this pull request to the merge queue Oct 28, 2024
@cblmemo
Copy link
Collaborator Author

cblmemo commented Oct 28, 2024

After an offline discussion we determined to merging now 🫡

Merged via the queue into master with commit 546cb17 Oct 28, 2024
20 checks passed
@cblmemo cblmemo deleted the delete-backward-compatibility branch October 28, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants