Skip to content

Commit 1a90dab

Browse files
authored
Merge pull request #752 from code0-tech/flow-to-grpc-is-failing
Fix flow errors and add logs
2 parents fe73ec0 + 889c53b commit 1a90dab

File tree

11 files changed

+28
-155
lines changed

11 files changed

+28
-155
lines changed

app/grpc/data_type_handler.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
class DataTypeHandler < Tucana::Sagittarius::DataTypeService::Service
44
include GrpcHandler
5+
include Code0::ZeroTrack::Loggable
56

67
def update(request, _call)
78
current_runtime = Runtime.find(Code0::ZeroTrack::Context.current[:runtime][:id])
89

910
response = Runtimes::Grpc::DataTypes::UpdateService.new(current_runtime, request.data_types).execute
1011

12+
logger.debug("DataTypeHandler#update response: #{response.inspect}")
13+
1114
Tucana::Sagittarius::DataTypeUpdateResponse.new(success: response.success?)
1215
end
1316
end

app/grpc/flow_handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class FlowHandler < Tucana::Sagittarius::FlowService::Service
1010
def self.update_runtime(runtime)
1111
flows = []
1212
runtime.project_assignments.compatible.each do |assignment|
13-
assignment.project.flows.each do |flow|
13+
assignment.namespace_project.flows.each do |flow|
1414
flows << flow.to_grpc
1515
end
1616
end

app/grpc/flow_type_handler.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
class FlowTypeHandler < Tucana::Sagittarius::FlowTypeService::Service
44
include GrpcHandler
5+
include Code0::ZeroTrack::Loggable
56

67
def update(request, _call)
78
current_runtime = Runtime.find(Code0::ZeroTrack::Context.current[:runtime][:id])
89

910
response = Runtimes::Grpc::FlowTypes::UpdateService.new(current_runtime, request.flow_types).execute
1011

12+
logger.debug("FlowTypeHandler#update response: #{response.inspect}")
13+
1114
Tucana::Sagittarius::FlowTypeUpdateResponse.new(success: response.success?)
1215
end
1316
end

app/grpc/runtime_function_handler.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
class RuntimeFunctionHandler < Tucana::Sagittarius::RuntimeFunctionDefinitionService::Service
44
include GrpcHandler
5+
include Code0::ZeroTrack::Loggable
56

67
def update(request, _call)
78
current_runtime = Runtime.find(Code0::ZeroTrack::Context.current[:runtime][:id])
@@ -11,6 +12,8 @@ def update(request, _call)
1112
request.runtime_functions
1213
).execute
1314

15+
logger.debug("RuntimeFunctionHandler#update response: #{response.inspect}")
16+
1417
Tucana::Sagittarius::RuntimeFunctionDefinitionUpdateResponse.new(success: response.success?)
1518
end
1619
end

app/models/node_parameter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def to_grpc
2121
elsif reference_value.present?
2222
param.value.reference_value = reference_value.to_grpc
2323
elsif function_value.present?
24-
param.value.function_value = function_value.to_grpc
24+
param.value.node_function_id = function_value.id
2525
end
2626

2727
param

app/policies/namespace_project_policy.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class NamespaceProjectPolicy < BasePolicy
1313
enable :read_flow
1414
end
1515

16+
rule { admin }.policy do
17+
enable :namespace_administrator
18+
end
19+
1620
customizable_permission :assign_project_runtimes
1721
customizable_permission :read_namespace_project
1822
customizable_permission :update_namespace_project

app/services/namespaces/projects/flows/create_service.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ def create_node_function(node_function_id, input_nodes, t)
121121
next
122122
end
123123
if parameter.value.function_value.present?
124+
# A little bit hacky but okay
124125
params << NodeParameter.create(
125126
runtime_parameter: runtime_parameter,
126-
function_value: create_node_function(parameter.value.function_value, input_nodes, t)
127+
function_value: create_node_function(
128+
parameter.value.function_value.id,
129+
[parameter.value.function_value], t
130+
)
127131
)
128132
next
129133
end

bin/docker-entrypoint

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
55
fi
66

77
if [ "${SAGITTARIUS_PREPARE_DATABASE}" == "true" ]; then
8-
bundle exec rake db:prepare
9-
FILTER=01_application_settings bundle exec rake db:seed_fu
8+
bundle exec rake db:prepare db:seed_fu
109
fi
1110

1211
exec "${@}"

db/fixtures/development/01_users.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,10 @@
2727
u.password = 'password'
2828
u.admin = false
2929
end
30+
31+
%w[Admin Maintainer Owner User].each do |username|
32+
UserSession.seed_once :token do |session|
33+
session.user = User.find_by(username: username)
34+
session.token = username
35+
end
36+
end

db/fixtures/development/07_datatypes.rb

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)