3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
|
# File 'lib/cnvrg/cli.rb', line 3750
def remote_notebook()
verify_logged_in(true)
log_start(__method__, args, options)
working_dir = is_cnvrg_dir()
instance_type = options["machine_type"] || nil
datasets = options["datasets"]
data = options["data"]
data_commit = options["data_commit"]
commit = options["commit"]
notebook_type = options["notebook_type"]
dataset_only_tree = options["dataset_only_tree"]
image = options["image"]
ds_sync_options = 0
if dataset_only_tree
ds_sync_options = 1
end
data_query = nil
if data.present?
data_query = options["data_query"]
end
if data_commit.present? and data_query.present?
log_message("Please use only one option: --query(-q) or --data_commit ", Thor::Shell::Color::RED)
exit(1)
end
begin
project = Project.new(working_dir)
exp = Experiment.new(project.owner, project.slug)
if !notebook_type.nil? and !notebook_type.empty?
notebook_type = "jupyter"
end
invoke :sync, [false], []
slug = ""
res = exp.remote_notebook(instance_type, commit, data, data_commit, notebook_type,ds_sync_options,data_query, image, datasets)
if Cnvrg::CLI.is_response_success(res)
slug = res["result"]["notebook_url"]
log_message("#{Helpers.checkmark} Notebook is ready: #{Cnvrg::Helpers.remote_url}/#{project.owner}/projects/#{project.slug}/notebook_sessions/show/#{slug}", Thor::Shell::Color::GREEN)
end
rescue => e
log_message("Error occurred, Aborting", Thor::Shell::Color::RED)
log_error(e)
rescue SignalException
log_message("Aborting", Thor::Shell::Color::BLUE)
notebook_stop(slug) unless slug.nil? or slug.empty?
exit(1)
end
end
|