Skip to content

Commit

Permalink
submitter ux improvement
Browse files Browse the repository at this point in the history
autolisten if ip not set
unset ip by default
ignore env res args with empty names
  • Loading branch information
pedohorse committed Jan 27, 2025
1 parent 01a3436 commit c98b44f
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
label "ip"
type string
joinnext
default { "127.0.0.1" }
default { "" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "import_source" "op:./lifeblood_submitter" }
parmtag { "import_token" "sch_ip" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
label "ip"
type string
joinnext
default { "127.0.0.1" }
default { "" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "import_source" "op:./lifeblood_submitter" }
parmtag { "import_token" "sch_ip" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
label "ip"
type string
joinnext
default { "127.0.0.1" }
default { "" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "import_source" "op:./lifeblood_submitter" }
parmtag { "import_token" "sch_ip" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
label "ip"
type string
joinnext
default { "127.0.0.1" }
default { "" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "import_source" "op:./lifeblood_submitter" }
parmtag { "import_token" "sch_ip" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ return \"package.houdini.py%d_%d\" % (sys.version_info.major, sys.version_info.m
flags = 0
segment { options = { autoslope ai ao }

length = 0 accel = 0.33333333333333331 0.33333333333333331 expr = "\"package.\" + hou.pwd().node(\"..\").evalParm(\"rs_pkg_name\")" language = python }
length = 0 accel = 0.33333333333333331 0.33333333333333331 expr = "ifs(ch(\"../rs_pkg_do\"), \"package.\" + chs(\"../rs_pkg_name\"), \"\")" language = hscript }
}
channel env_arg_val_2 {
lefttype = extend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
label "ip"
type string
joinnext
default { "127.0.0.1" }
default { "" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "import_source" "op:./lifeblood_submitter" }
parmtag { "import_token" "sch_ip" }
Expand Down Expand Up @@ -280,19 +280,30 @@
name "folder3_1"
label "Redshift Package"

parm {
name "rs_pkg_do"
label "Require package"
type toggle
joinnext
default { "1" }
parmtag { "script_callback_language" "python" }
}
parm {
name "rs_pkg_name"
label "Name"
type string
nolabel
joinnext
default { "redshift" }
disablewhen "{ rs_pkg_do == 0 }"
parmtag { "script_callback_language" "python" }
}
parm {
name "rs_pkg_ver"
label "Version"
type string
default { [ "if hasattr(hou.session, '_lifeblood__rs_ver_str'):\n return hou.session._lifeblood__rs_ver_str\n\nreturn 'error! cannot autodetect'" python ] }
disablewhen "{ rs_pkg_do == 0 }"
parmtag { "script_callback_language" "python" }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
label "ip"
type string
joinnext
default { "127.0.0.1" }
default { "" }
parmtag { "script_callback_language" "python" }
}
parm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ except ImportError:


def submit_button_callback(node):
# first - check for trivial error if user have not set up scheduler address
if node.evalParm("sch_ip").strip() == '': # default "invalid" value
if hou.ui.displayMessage(
'You haven\'t set up scheduler address.\nDo you want to listen for scheduler\'s broadcast?',
buttons=('Yes', 'Cancel'),
default_choice=0,
close_choice=1) == 1:
return
if not fill_address_from_broadcast(node):
return

if hou.hipFile.hasUnsavedChanges():
if hou.ui.displayMessage('scene has unsaved changes, save and continue?', buttons=('Ok', 'Cancel'),
severity=hou.severityType.Warning,
Expand Down Expand Up @@ -48,7 +59,11 @@ def submit(node):
env_args = {}
env_name = node.evalParm('env_resolver_name')
for i in range(node.parm('env_resolver_args').evalAsInt()):
env_args[node.evalParm('env_arg_name_%d' % i)] = node.evalParm('env_arg_val_%d' % i)
arg_name = node.evalParm('env_arg_name_%d' % i)
# skip empty names
if arg_name.strip() == '':
continue
env_args[arg_name] = node.evalParm('env_arg_val_%d' % i)
task.set_environment_resolver(env_name, env_args)

for i in range(node.parm('attribs').evalAsInt()):
Expand Down Expand Up @@ -131,15 +146,22 @@ def fill_address_from_broadcast(node):
ip, port = address_from_broadcast(node)
except hou.OperationInterrupted:
if hou.isUIAvailable():
hou.ui.displayMessage('waiting interrupted', severity=hou.severityType.Warning)
# this try-except block here is to workaround a bug in some hou builds
# that reraises OperationInterrupted exception
try:
hou.ui.displayMessage('waiting interrupted', severity=hou.severityType.Warning)
except hou.OperationInterrupted:
pass
else:
print('waiting interrupted')
return False
if ip is None:
if hou.isUIAvailable():
hou.ui.displayMessage('did not receive a broadcast within timeout', severity=hou.severityType.Warning)
else:
print('did not receive a broadcast within timeout')
return
return False
assert port is not None
node.parm('sch_ip').set(ip)
node.parm('sch_port').set(port)
return True
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
label "ip"
type string
joinnext
default { "127.0.0.1" }
default { "" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "import_source" "op:./lifeblood_submitter" }
parmtag { "import_token" "sch_ip" }
Expand Down

0 comments on commit c98b44f

Please sign in to comment.