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

Handle python's 120 exit code #340

Closed
wants to merge 4 commits into from
Closed

Handle python's 120 exit code #340

wants to merge 4 commits into from

Conversation

sgillies
Copy link

@sgillies sgillies commented Jul 7, 2020

See https://docs.python.org/3/library/sys.html#sys.exit. 120 is the python interpreter's only special code.

This works around issue #339. There's a deeper problem to be solved, but even so this is a useful patch. We never want to retry in the case that the worker gets a 120 exit code from python.

@sgillies sgillies added the bug label Jul 7, 2020
@sgillies sgillies requested a review from rclark July 7, 2020 16:22
Copy link
Contributor

@rclark rclark left a comment

Choose a reason for hiding this comment

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

Could you add a test for this exit code, similar to this one?

test('[worker] waitFor, exit 4', async (assert) => {
const logger = stubber(Logger).setup();
logger.log.restore();
logger.stream.restore();
const message = sinon.createStubInstance(Message);
message.env = { Message: 'banana', SentTimestamp: '2019-02-09T21:57:55.000Z' };
const options = { command: 'exit 4', volumes: ['/tmp'] };
const worker = new Worker(message, options);
sinon.spy(child_process, 'spawn');
try {
await worker.waitFor();
} catch (err) {
assert.ifError(err, 'failed');
}
const results = logger.workerSuccess.args[0][0];
assert.equal(results.code, 4, 'logged worker success exit code');
assert.ok(results.duration, 'logged worker success duration');
assert.ok(results.response_duration, 'logged worker response duration');
assert.equal(message.retry.callCount, 1, 'calls message.retry()');
child_process.spawn.restore();
logger.teardown();
assert.end();

test/worker.test.js Outdated Show resolved Hide resolved
@sgillies
Copy link
Author

sgillies commented Jul 7, 2020

@rclark ok, test added.

logger.log.restore();
logger.stream.restore();
const message = sinon.createStubInstance(Message);
message.env = { Message: 'forty bananas', SentTimestamp: '2020-11-03T21:57:55.000Z' };
Copy link
Contributor

Choose a reason for hiding this comment

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

yummy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants