我成功运行了一个 AWS Glue 作业,用于转换数据以进行预测。如果达到特定条件,我想停止处理并输出状态消息(正在运行):
if specific_condition is None:
s3.put_object(Body=json_str, Bucket=output_bucket, Key=json_path )
return None
Run Code Online (Sandbox Code Playgroud)
这会产生“SyntaxError:'return'外部函数”,我尝试过:
if specific_condition is None:
s3.put_object(Body=json_str, Bucket=output_bucket, Key=json_path )
job.commit()
Run Code Online (Sandbox Code Playgroud)
这不是在 AWS Lambda 中运行,而是使用 Lambda 启动的胶水作业(例如 start_job_run())。
我只是学习PyQt而且我有一个小应用程序,似乎工作正常单位我点击对话框右上角的X关闭它.当我这样做并返回控制台时,我发现异常已经引发如下:
To exit: use 'exit', 'quit', or Ctrl-D.
An exception has occurred, use %tb to see the full traceback.
SystemExit: 0
In [2]: %tb
Traceback (most recent call last):
File "<ipython-input-1-4524246fa84a>", line 1, in <module>
runfile('C:/Users/21025/simpleAdder.pyw', wdir='C:/Users/21025')
File "C:\Users\21035\AppData\Local\Continuum\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 586, in runfile
execfile(filename, namespace)
File "C:/Users/21035/simpleAdder.pyw", line 81, in <module>
sys.exit(app.exec_())
SystemExit: 0
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么 ?该应用程序的代码如下所示:
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return …Run Code Online (Sandbox Code Playgroud) 我正在使用 Glue 书签来处理数据。我的工作是每天安排的,但也可以“手动”启动。由于我使用书签,有时胶水作业可以在没有新数据要处理的情况下启动,然后读取的数据帧为空。在这种情况下,我想好好地结束我的工作,因为它没有什么关系。我试过:
if df.rdd.isEmpty():
job.commit()
sys.exit(0)
Run Code Online (Sandbox Code Playgroud)
但是,我的工作因错误而终止SystemExit: 0。
如何圆满结束工作?