Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openwhisk-runtime-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Groundhog
openwhisk-runtime-python
Commits
33ecd7ab
Commit
33ecd7ab
authored
9 years ago
by
Perry Cheng
Browse files
Options
Downloads
Patches
Plain Diff
Lift a require so file handle use done early; move a file close from catch to finally
parent
684b3539
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/dispatcher/src/whisk/core/container/ContainerUtils.scala
+5
-2
5 additions, 2 deletions
.../dispatcher/src/whisk/core/container/ContainerUtils.scala
core/nodejsAction/runner.js
+2
-1
2 additions, 1 deletion
core/nodejsAction/runner.js
with
7 additions
and
3 deletions
core/dispatcher/src/whisk/core/container/ContainerUtils.scala
+
5
−
2
View file @
33ecd7ab
...
...
@@ -128,9 +128,10 @@ trait ContainerUtils extends Logging {
* It is assumed that the contents does exist and that region is not changing concurrently.
*/
def
getDockerLogContent
(
containerId
:
String
,
start
:
Long
,
end
:
Long
,
mounted
:
Boolean
)(
implicit
transid
:
TransactionId
)
:
Array
[
Byte
]
=
{
var
fis
:
java.io.FileInputStream
=
null
try
{
val
file
=
getDockerLogFile
(
containerId
,
mounted
)
val
fis
=
new
java
.
io
.
FileInputStream
(
file
)
fis
=
new
java
.
io
.
FileInputStream
(
file
)
val
channel
=
fis
.
getChannel
().
position
(
start
)
var
remain
=
(
end
-
start
).
toInt
val
buffer
=
java
.
nio
.
ByteBuffer
.
allocate
(
remain
)
...
...
@@ -140,13 +141,15 @@ trait ContainerUtils extends Logging {
remain
=
read
-
read
.
toInt
Thread
.
sleep
(
50
)
// TODO What is this for?
}
fis
.
close
()
buffer
.
array
}
catch
{
case
e
:
Exception
=>
error
(
this
,
s
"getDockerLogContent failed on $containerId"
)
Array
()
}
finally
{
if
(
fis
!=
null
)
fis
.
close
()
}
}
def
getContainerHost
(
container
:
ContainerName
)(
implicit
transid
:
TransactionId
)
:
ContainerIP
=
{
...
...
This diff is collapsed.
Click to expand it.
core/nodejsAction/runner.js
+
2
−
1
View file @
33ecd7ab
...
...
@@ -21,6 +21,8 @@
* This file (runner.js) must currently live in root directory for nodeJsAction.
* See issue #102 for a discussion.
*/
var
util
=
require
(
'
util
'
);
function
NodeActionRunner
(
message
,
whisk
,
console
)
{
this
.
userScriptName
=
getname
(
message
.
name
);
this
.
userScriptMain
=
undefined
;
...
...
@@ -39,7 +41,6 @@ function NodeActionRunner(message, whisk, console) {
function
closeAndReturn
(
result
)
{
var
hrEnd
=
process
.
hrtime
();
var
util
=
require
(
'
util
'
);
if
(
typeof
callback
.
closedConnection
==
'
undefined
'
)
{
callback
.
closedConnection
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment