mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 19:18:01 -05:00
4d481ebccb9b2ef31c8befcf15dc79ba4d4aa2d1
69
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a9bea6567c |
fix(emr): give back a cluster's Kerberos realm, OS release, root volume, placement groups and logging settings (#9183)
RunJobFlow dropped the cluster's KerberosAttributes, OSReleaseLabel, EbsRootVolumeIops, EbsRootVolumeThroughput, PlacementGroupConfigs, LogEncryptionKmsKeyId, RepoUpgradeOnBoot and MonitoringConfiguration, so DescribeCluster gave back none of them. - DescribeCluster gives each back as it was asked for, the placement group configs as its PlacementGroups. - OSReleaseLabel is the one asked for, else the latest Amazon Linux release DescribeReleaseLabel lists for the cluster's release, as "If no Amazon Linux release was specified, the default Amazon Linux release is shown in the response". - RepoUpgradeOnBoot is SECURITY for a cluster with a custom AMI that names none, as "If omitted, the default is SECURITY". - Of KerberosAttributes only the Realm is kept and given back, never a password, and a cluster without them answers an empty structure, as AWS does. - A member the model requires, or a value outside its enum, is refused with the framework's ValidationException. So are two placement groups for one instance role, and one for the primary nodes of a cluster without three of them (three on-demand and no spot for a fleet), in the words AWS answers them with. - As only the primary nodes take a placement group, with SPREAD or NONE, another role or strategy is refused, in Floci's words, and a group without a strategy gets SPREAD, as the Management Guide says. - AWS::EMR::Cluster passes these properties to RunJobFlow rather than warning that they are not stored. |
||
|
|
0171af4bce |
fix(emr): give back the subnets, zones, instance profile and security groups a cluster asked for (#9180)
DescribeCluster's Ec2InstanceAttributes kept only the key name, subnet, zone and managed security groups. The JobFlowRole, the instance fleets' Ec2SubnetIds and Placement.AvailabilityZones, and the additional master and slave security groups that RunJobFlow took were dropped, so a client reading the cluster back, as Terraform's aws_emr_cluster does, saw none of them. - IamInstanceProfile is the JobFlowRole, "The IAM role that was specified when the cluster was launched". - RequestedEc2SubnetIds and RequestedEc2AvailabilityZones are the ones requested, an empty list when none was, as AWS gives them. The subnet is the one Ec2SubnetId names, else the first of Ec2SubnetIds, and the zone the one Placement names, else the first of its AvailabilityZones. - A request naming both subnets and zones is refused with ValidationException, as "RequestedEc2SubnetIDs and RequestedEc2AvailabilityZones cannot be specified together". - AdditionalMasterSecurityGroups and AdditionalSlaveSecurityGroups are the ones given, and a list member of another JSON type is refused with SerializationException. - AWS::EMR::Cluster no longer warns that Instances' Ec2SubnetIds and additional security groups are not stored. |
||
|
|
cff222a6f1 |
fix(emr): keep instance fleets' launch and resize specifications, and modify their configs (#9168)
An instance fleet dropped the LaunchSpecifications, ResizeSpecifications and Context that RunJobFlow and AddInstanceFleet gave it, and ModifyInstanceFleet changed its target capacities alone, ignoring the ResizeSpecifications, InstanceTypeConfigs and Context it took. - A fleet keeps its LaunchSpecifications, ResizeSpecifications and Context, and ListInstanceFleets gives them back. - ModifyInstanceFleet changes the ResizeSpecifications, InstanceTypeConfigs and Context it gives. The configs replace the fleet's own, as the Management Guide warns that "Not including fields can result in overwriting specifications you declared at launch", and must name every instance type the fleet has, as "You must include all instance types that are part of your instance fleet in the modify request". A request that leaves one out is refused with InvalidRequestException. Its configs are checked as AddInstanceFleet checks them, and on both calls specifications that are not an object, or a Context that is not a string, are refused with SerializationException. - AWS::EMR::Cluster no longer warns that a fleet's launch and resize specifications are not stored, and AWS::EMR::InstanceFleetConfig now applies a change to InstanceTypeConfigs or ResizeSpecifications in place rather than warning. A rollback puts them back, but not an instance type the update added, which every later request must include, nor resize specifications where the fleet had none, which no request can clear. The update is checked as ModifyInstanceFleet checks its request, before anything changes, and dropped configs or resize specifications are kept. |
||
|
|
5a912d5263 |
fix(emr): keep instance groups' volumes, AMI and shrink policy, and list instances' volumes and public address (#9163)
An instance group dropped the EbsConfiguration and CustomAmiId that RunJobFlow and AddInstanceGroups gave it, and ModifyInstanceGroups its ShrinkPolicy, and ListInstances gave no instance an EbsVolumes or a PublicIpAddress. - A group keeps its EbsConfiguration and CustomAmiId, and ListInstanceGroups gives them back as its EbsBlockDevices, one per volume named /dev/sdb on as a fleet's are, its EbsOptimized and its CustomAmiId, under the same limit of 25 volumes per instance. - ModifyInstanceGroups keeps a group's ShrinkPolicy, which ListInstanceGroups gives back, and a shrink it comes with follows its InstanceResizePolicy: the instances it names to terminate end first, then the group's last instances, passing the protected ones. They end as EC2InstanceIdsToTerminate ends them, so their ids are not taken again, and a later entry for the same group counts from what an earlier one leaves. An id to terminate that is not a running instance of the group is refused, as EC2InstanceIdsToTerminate refuses it, and so is a shrink the protected instances leave short. - ListInstances gives each instance the PublicIpAddress its PublicDnsName names, in 203.0.113.0/24 for a cluster's first 254 instances and in 100.64.0.0/10 past them, and an EbsVolumes entry for each device its group or instance type config gives it, with volume ids that differ between clusters. A group's instances' EC2 descriptions give its CustomAmiId as their image. - AWS::EMR::Cluster no longer warns that a group's EbsConfiguration and CustomAmiId are not stored. |
||
|
|
4595e8d1ef |
fix(emr): terminate the instances ModifyInstanceGroups' EC2InstanceIdsToTerminate names (#9142)
ModifyInstanceGroups ignored EC2InstanceIdsToTerminate, "The Amazon EC2 InstanceIds to terminate. After you terminate the instances, the instance group will not return to its original requested size." Floci's instances had no identity of their own: their ids and addresses followed their place in their group, so a group could only shrink from its end. Each instance group now keeps the ordinals of the instances those ids ended, and its instances take the first ordinals that are not among them. The named instances leave ListInstances and, in the docker runner mode, take their core or task node with them, HDFS moving its blocks first, as nodes are named by group and ordinal. The group's requested and running counts go down by as many. Its other instances keep their ids, addresses and nodes, as do the cluster's other groups', and an instance the group gets later takes a new ordinal, not an ended one's. An InstanceCount beside them is the group's size after that. An id that is not one of the group's instances is refused with ValidationException, as ModifyInstanceGroups' other refusals are recorded, and a MASTER group's with the refusal its count gets; AWS's wording for these is not documented, so it is Floci's. |
||
|
|
8a0112d9c5 |
fix(emr): honour CancelSteps' StepCancellationOption, SIGTERM by default (#9139)
CancelSteps took no StepCancellationOption: a cancelled RUNNING step's container was killed at once, which is TERMINATE_PROCESS. The Management Guide's "Cancel steps" makes SEND_INTERRUPT the default: "EMR sends a SIGTERM signal to the step", which may catch it "to terminate descendant step processes or wait for them to complete"; with TERMINATE_PROCESS "EMR sends a SIGKILL signal to the step and all its descendant processes which terminates them immediately". With SEND_INTERRUPT the step's container now gets SIGTERM and the step stays CANCEL_PENDING until its command ends on its own, CANCELLED then, without its ActionOnFailure. A step's container runs under an init process, as Docker's --init runs one, so that the signal reaches its command: a container's first process ignores SIGTERM unless it handles it. A step whose container is not running yet has nothing to interrupt, and is stopped as before. TERMINATE_PROCESS kills it at once, as every cancel did, with SIGKILL alone, as Docker's own stop would send SIGTERM first and the init would pass it on; it also kills a step a SEND_INTERRUPT cancel left running, and a cluster's end kills such a step too. An option that is neither gets the framework's enum message. A CancelSteps request takes at most 100 steps from release 7.14.0, and 256 before it, as "With Amazon EMR releases 7.14.0 and later, the maximum number of steps you can cancel per request is 100". |
||
|
|
7ae2339100 |
fix(emr): apply MERGE reconfigurations, step log locations, the scaling index and ServerUrl (#9129)
Four members EMR accepted and ignored now act as AWS documents them. ModifyInstanceGroups' ReconfigurationType MERGE merges the group's new Configurations into its own, as the Release Guide's "Reconfigure an instance group in a running cluster" has it: "This option only adds or modifies the new configurations that you submit. It preserves existing configurations." A classification it names takes its properties over the group's, nested configurations merged the same way, and the others stay; OVERWRITE, the default, still replaces them. MERGE is "supported for Amazon EMR releases 5.35.0 and 6.6.0 and later", so an earlier release refuses it with ValidationException, in Floci's wording, and a type that is neither gets the framework's enum message. A step's StepMonitoringConfiguration sends its logs, and its applications' container logs, to its own LogUri from release 7.11, as its options "take precedence over any cluster-wide logging settings", still only on a cluster with a LogUri. The guide gives no layout under the step's destination, so it is the cluster's. A node removed while such steps run puts its containers' logs there when they share one. DescribeStep and ListSteps give the step's LogUri and EncryptionKeyArn back. A managed scaling policy's UtilizationPerformanceIndex is one of 1, 25, 50, 75 and 100: "If you set the index to values other than these, it results in a validation error." One outside the model's 1 to 100 gets the framework's ValidationException, another Floci's wording. A session whose Spark Connect server answers reports ServerUrl, Floci's own address in Spark Connect's sc:// form, where a call still needs GetSessionEndpoint's token to reach the server; an ended session has none. |
||
|
|
89e0242167 |
fix(emr): list every emr-7.x and emr-spark release, as AWS names and orders them (#9114)
ListReleaseLabels, DescribeReleaseLabel and ListSupportedInstanceTypes knew five releases, the newest emr-7.5.0, so they refused emr-7.13.0 and the emr-spark-8.x releases Floci runs clusters on. The catalogue now holds every emr-7.x release, emr-7.0.0 to emr-7.14.0, and the AWS runtime for Apache Spark's emr-spark-8.0.0, 8.1.0 and 8.2.0, beside emr-6.15.0, emr-6.14.0 and emr-5.36.2. Each release's applications, versions and Amazon Linux releases come from its Release Guide page, as before; the emr-7.14.0, emr-spark-8.1.0 and emr-spark-8.2.0 pages list no Amazon Linux release, so those report none. Application names are spelled as AWS answers them, Spark, HBase, ZooKeeper and JupyterHub, where they were lowercased; each page lists them that way too, with Trino for "Trino (PrestoSQL)". The Application filter of ListReleaseLabels still matches without regard to case. ListReleaseLabels lists the numbered releases newest first, and the emr-spark ones after them oldest first, the order AWS answered for that family. DescribeReleaseLabel without a label describes the first release listed, now emr-7.14.0. An unknown release label gets AWS's recorded answers, which differ by operation: DescribeReleaseLabel "The release label isn't valid." with ErrorCode InvalidInputParameter, and ListSupportedInstanceTypes "The supplied release label is invalid: <label>." with ErrorCode INVALID_RELEASE_LABEL, a missing label reading null. A blank label is refused there too, and a blank default-release-label setting no longer adds an empty release to the list. |
||
|
|
6b420b166f |
fix(emr): make a uniform RunJobFlow cluster's master and core instance groups (#9107)
RunJobFlow's uniform form, MasterInstanceType, SlaveInstanceType and InstanceCount in place of InstanceGroups or InstanceFleets, made no instance groups, so ListInstanceGroups listed none, ListInstances no instances, and with runner-mode docker the cluster ran on its primary node alone. It now makes the groups the API reference describes: "If the value is 1, the same instance serves as both the master and core and task node. If the value is greater than 1, one instance is the master node and all others are core and task nodes." That is a MASTER group of one MasterInstanceType instance and, for a count above 1, a CORE group of the rest as SlaveInstanceType, both ON_DEMAND. The master group is named "Master InstanceGroup", as in DescribeJobFlows' sample response; no source names the core group, so Floci names it "Core InstanceGroup". A request that gives InstanceGroups or InstanceFleets keeps its own. A request for more than one instance without SlaveInstanceType is refused with a ValidationException, as JobFlowInstancesConfig says "all three must be present"; a single instance needs none, as AWS runs one without it. However many instances a cluster asks for, in this form or any other, its core and task nodes are now built no further than yarn-max-worker-nodes, where every one asked for was built before the rest were dropped. |
||
|
|
5fa518cf10 |
feat(emr): keep a cluster's application history and open its persistent UIs for real in the docker runner mode (#8817)
With runner-mode docker, GetPersistentAppUIPresignedURL now opens the persistent application UI's interface for real, SHS the Spark History Server, YTS the YARN timeline server and TEZ the Tez UI, on a host of its own as an on-cluster UI does: while the cluster runs, its primary node's; once it has ended, as "You can access application history and relevant log files for active and terminated clusters", its kept history's, for the 30 days for which "The logs are available ... after the application ends". The primary node of a cluster that runs either history interface mounts a volume of its own, which holds the timeline server's store (its entities kept 30 days rather than Hadoop's 7), and into which, as the cluster's storage goes, or as a reset or a shutdown removes a node still running, its Spark applications' event logs are copied out of its HDFS; the cluster's other storage goes as before, though a copy that fails keeps it, the event logs in it, for a later try or a restart to remove. The URL is not PresignedURLReady while the cluster is ending or its storage is going. Then a container of the image the cluster ran serves it, on a network of its own that no step's container is on, started by the first link, the URL not PresignedURLReady until it answers, and stopped once no link to it is valid, a later link starting it again; with no ResourceManager there, the Tez UI's asks for one go to the timeline server. A kept history goes once its 30 days have passed, whether or not a link asked for it. A restart keeps the histories of the clusters that ended within 30 days, a reset or a shutdown removes the containers, and a reset every history. Elsewhere, the link still opens Floci's own page. EmrAppUiNightlyIntegrationTest runs it for real: a persistent UI opens the cluster's Spark History Server while it runs, and, once it has ended and its storage has gone, its kept history: the Spark application, the Hive query's Tez DAG and the Tez UI's page. |
||
|
|
3210ee0263 |
feat(emr): run the YARN timeline server and the Tez UI on a cluster's primary node in the docker runner mode (#8804)
With runner-mode docker, a cluster with Hadoop now runs the YARN
timeline server on its primary node, and one with Tez too the Tez UI
("Tez | http://master-public-dns-name:8080/tez-ui"), and
GetOnClusterAppUIPresignedURL opens both for real, on their own hosts,
as the cluster's other interfaces open (YarnTimelineService, TezUI).
The timeline server is Hadoop's own on its default port, 8188, its
store on the primary node's volume; the ResourceManager publishes its
applications to it, and, as no source gives how EMR's Tez reaches it, a
Hive step's Tez logs its DAGs to it through its REST interface
(ATSHistoryLoggingService). The Tez UI is Tez's own page, served on
8080, whose configuration (/etc/tez-ui/conf/configs.js, which the
image's page links to and lacks) names the timeline server and the
ResourceManager by the node's name, which Floci makes the link's hosts;
both answer cross-origin requests from the Tez UI's host. Both start
with the node's other daemons, the timeline server before the
ResourceManager, and the node is ready once both answer. The Tez UI runs
where the cluster's image has Tez, one with Hive or Floci's Pig, and an
image without its files serves none rather than keep the node from being
ready. Neither runs
for a release of the AWS runtime for Apache Spark, as their persistent
interfaces are not there.
EmrAppUiNightlyIntegrationTest runs them for real: after a Hive step,
the timeline server holds its Tez DAG and its application history, and
the Tez UI's page and configuration open, the timeline server answering
a request from the Tez UI's host.
|
||
|
|
0475f96d85 |
feat(emr): run a Spark History Server on a cluster's primary node in the docker runner mode (#8796)
With runner-mode docker, a cluster with Spark now runs a Spark History
Server on its primary node, as EMR's does ("Spark HistoryServer |
http://master-public-dns-name:18080/"), and GetOnClusterAppUIPresignedURL
opens it for real, on its own host, as the cluster's other interfaces
open.
Where the primary node runs the server, a step's Spark on the cluster's
YARN keeps its event logs where "By
default, Amazon EMR stores event logs in the /var/log/spark/apps
directory of HDFS" (spark.eventLog.dir hdfs:///var/log/spark/apps, which
the cluster's spark-defaults may replace), and names the server as
spark.yarn.historyServer.address, so an ended application's tracking URL
leads to its page there. The primary node makes that folder with the
others in its HDFS, starts the server once it is there, reading it and
listening where HDFS does, as one of the node's daemons, and is ready
once it answers. Its port is published on the host's loopback interface
as the other interfaces' are. With an ApplicationId, the server's link
lands on the application's page.
EmrAppUiNightlyIntegrationTest runs it for real: after a SparkPi step,
the ResourceManager's proxy sends the application's tracking URL on to
its page on the server's own host, the server lists it from its event
logs, and the server's own link lands on it.
|
||
|
|
4b342dad3f |
feat(emr): open a cluster's on-cluster application UIs for real in the docker runner mode (#8773)
With runner-mode docker, GetOnClusterAppUIPresignedURL now opens the interfaces that run on the cluster's primary node for real: its ResourceManager, an application master through the ResourceManager's web proxy, its MapReduce JobHistory server, and the NodeManager of a primary node that works. Each opens on a host of its own, as AWS's application UIs do under emrappui-prod.<region>.amazonaws.com, which are on the Public Suffix List: http://<secret>-<port>.emrappui.<Floci's host and port>/, the secret 26 random base32 characters only the link holds, so the host is the link's authority, as the interface takes no AWS credentials. EmrAppUiProxy, a Vert.x route ahead of the REST layer, sends a request to that host on to the node's port, which the primary node publishes on the host's loopback interface (Floci in a container joins the cluster's network instead). It asks the interface under the browser's host, so the links the interface writes itself are the browser's, and makes each link the node's daemons write to one another by the node's name a link to that interface's own host under the same secret, in text answers and Location headers; an answer too large to hold goes on unchanged. A request's body streams on as it arrives, an interface that sends nothing for a minute has the request given up, and a link of a cluster that has ended opens nothing, the node's port it found asked for again every ten seconds while the cluster runs. A link asked for before the primary node runs, as on a cluster no step has run on yet, starts the node as a step would, through runOnCluster, running nothing, and is not PresignedURLReady until the node is; its host answers 503 meanwhile. With an ApplicationId each interface lands on the application's page. The link lasts an hour, as Floci's page links do. An interface Floci does not run (the Spark History Server, the YARN timeline server, the Tez UI), and any link in the immediate mode, still opens Floci's own page. Floci's TLS certificate names *.emrappui.localhost and *.emrappui.localhost.floci.io. Lambda's CreateFunction and UpdateFunctionCode now refuse a direct ZipFile upload over 50 MB from its Base64 length, before decoding it, so a request already over the limit takes no more memory than it came in; its RequestEntityTooLargeException is as before, and the test of it builds its oversized upload without the bytes behind it. EmrAppUiNightlyIntegrationTest runs it for real on an emr-7.5.0 cluster: the ResourceManager's link starts the primary node and opens the ResourceManager, and after a MapReduce step its REST answer's links open the application master's logs on the NodeManager's host and, through the web proxy's redirect, the job on the JobHistory server's host, as the JobHistory server's own link does. The nightly job's timeout and image prefetch take the new check. |
||
|
|
9821a919b6 |
feat(emr): run a notebook execution's notebook on its cluster in the docker runner mode (#8764)
With runner-mode docker, StartNotebookExecution now runs the notebook on its cluster as a step's command runs: a spark-submit there, a YARN application with the cluster's Spark settings, as the execution's ExecutionRoleArn, else the cluster's instance profile, with its EnvironmentVariables (KERNEL_EXTRA_SPARK_OPTS, as AWS's example passes, going to spark-submit as its options). No source names AWS's kernel, so a program of Floci's own runs it, needing only Python and PySpark, which every release's image has, not Jupyter: it reads the notebook through the cluster's S3A, puts NotebookParams in papermill's way (a cell tagged injected-parameters after the one tagged parameters, else first, in place of any an earlier run left; a name that is not a Python variable's fails the run), clears every earlier output, runs the code cells in one namespace holding spark and sc, keeping each one's output, its last expression's value and any error, stops at the first cell that raises, and writes the notebook as run as <name>.ipynb and <name>.html, then exits 3. A %%sql cell runs its body with spark.sql, a %%local or %%spark one as Python, and other cell magics are not run; % and ! lines are dropped only from a cell that is not Python as it stands. The notebook is the execution's NotebookS3Location; Floci keeps no EMR Notebook's own S3 location, so an execution named by EditorId alone fails at once. No source gives where AWS writes the notebook as run, so Floci writes it under the OutputNotebookS3Location prefix, else beside the notebook, in a folder named for the execution, and reports the one OutputNotebookFormat names, the HTML one, else the notebook, as OutputNotebookURI. The execution is START_PENDING until its container runs, then RUNNING, and FINISHED, FAILED at the first raising cell (any other failure giving the run's exit code), or STOPPED, StopNotebookExecution going through STOPPING; its cluster's end stops it, and one a restart left behind fails as interrupted. EmrService.runOnCluster runs such a command on a cluster through the cluster preparation steps and sessions share, its cluster's storage held while it runs and its end stopping it. As a step's, its thread starts nothing once its cluster has shut down or a reset's or a shutdown's teardown has begun; one that cannot be handed to its thread ends at once. EmrNotebookExecutionNightlyIntegrationTest runs it for real on an emr-7.5.0 cluster: a parameterized notebook's run, an earlier run's parameters in it, written to S3 with its outputs, its %%sql cell's among them, and HTML; a failing notebook's FAILED with its error kept and an earlier run's later outputs gone; and a misnamed parameter's run failed with its exit code. The nightly job's timeout and image prefetch take the new check. |
||
|
|
2517edb471 |
feat(emr): run a session's Spark Connect server on its cluster in the docker runner mode (#8751)
With runner-mode docker, StartSession now runs the session's Spark Connect server on its cluster, as "Amazon EMR launches a Spark Connect Server as a YARN application on your cluster": a container on the cluster as a step's is, in the image its steps run in, its HDFS and YARN started first where they are not running, the server's driver in that container and its executors on the cluster's YARN. Its spark-defaults are the cluster's, then the session's EngineConfigurations, with the server's port; it runs as the session's ExecutionRoleArn, else the cluster's instance profile. A client reaches it through Floci as an EMR Serverless session's server is reached (#8731): GetSessionEndpoint answers Floci's address and a token, and a client connects with sc://<host>:<port>/;x-aws-proxy-auth=<token>;authorization=<session id>, AWS's string with Floci's port. The proxy drops the authorization parameter, which AWS's own proxy reads, before the call reaches the server. The session is SUBMITTED until its container runs, STARTING until the server answers, then IDLE, BUSY while a call runs on its server and IDLE again once none does. TerminateSession goes through TERMINATING until the server has stopped; the idle timeout stops it too, and the cluster's end ends its sessions and stops their servers on its own, its storage released only once the last of them has gone. A server that exits on its own, or does not answer within 10 minutes, fails the session; one a restart left behind fails as interrupted, its container removed. What EMR Serverless's sessions and these share moves into emrserverless.SparkConnectServers: running each server, asking it whether it answers, the tokens, the calls a session takes, and one check for its next deadline; and SparkConnectSessionOwner, the states a session goes through as its server starts, answers, takes calls and stops, each service giving only how it stores, ends and checks its sessions (both models implement SparkConnectSession). A server being stopped takes no new call, a call's busy and idle reach the owner in order under the server's own lock, and a server's entry goes even where its owner fails to hear it stopped. A step's setup on its cluster (its image, storage, metadata address, added nodes and HDFS) moves into a preparation that steps and sessions' servers share. EmrSessionServerNightlyIntegrationTest runs it for real on an emr-spark-8.1.0 cluster with Spark 4's JVM client from that image: a wrong token refused, queries run, a missing table's Spark error back, TerminateSession removing the server. The nightly job's timeout and image prefetch take the new check. |
||
|
|
6618ae3de6 |
fix(emr): scope Studio list markers to their account, Region and filters (#8740)
ListStudios used one constant namespace for its markers, and ListStudioSessionMappings its Studio and identity type joined with String.valueOf. A marker from another account or Region therefore resumed this one's listing at its cursor, and an absent filter could not be told apart from the text "null". Both now scope their markers as ListNotebookExecutions does (#8705): a JSON list of the operation, the account, the Region and each filter, so any other marker is refused with InvalidRequestException "Invalid Marker.". The JSON list moves from EmrNotebookExecutionService to EmrService.listingNamespace, which all three listings use. |
||
|
|
e078bb7b00 |
feat(emr): answer GetClusterSessionCredentials for runtime role clusters (#8714)
GetClusterSessionCredentials, "temporary, HTTP basic credentials that are associated with a given runtime IAM role and used by a cluster with fine-grained access control activated", was not served. Floci now answers it with a random username and password that expire in an hour, for a RUNNING or WAITING cluster on emr-6.11.0 or later whose security configuration turns on runtime roles (EnableApplicationScopedIAMRole); any other cluster is refused. Floci runs no endpoint that checks them, and keeps none. A request without an ExecutionRoleArn is refused, as the credentials are "associated with a given runtime IAM role". Whether a cluster is a runtime role enabled one is now recorded as it is created, so a security configuration deleted or reused later changes nothing; CreatePersistentAppUI's RuntimeRoleEnabledCluster reads the same. |
||
|
|
751c97dde6 |
feat(emr): keep persistent application UIs and answer their presigned URLs (#8711)
EMR's application UI operations, CreatePersistentAppUI, DescribePersistentAppUI, GetPersistentAppUIPresignedURL and GetOnClusterAppUIPresignedURL, were not served. Floci now keeps a cluster's persistent application UIs, with the types its release and applications give it (the Spark History Server from 5.25.0, the Tez UI and YARN timeline server from 5.30.1), refusing a cluster with more than one primary node and an account past 200, and reports whether the cluster's security configuration turns on runtime roles. It serves none of those UIs: a presigned URL, persistent or on-cluster, opens a signed one-hour page of Floci's about the cluster and the interface asked for. The link signing of EMR Serverless's dashboards and these pages is one helper, core.common.LinkSigner, and their HTML page and table rows come from core.common.Html. |
||
|
|
e0ef191767 |
feat(emr): keep notebook executions on a cluster (#8705)
EMR's notebook execution operations, StartNotebookExecution, DescribeNotebookExecution, StopNotebookExecution and ListNotebookExecutions, were not served. Floci now keeps notebook executions and their lifecycle, without running a notebook. An execution needs a RUNNING or WAITING cluster that meets the EMR Notebooks cluster requirements (release 5.18.0 or later, with Hadoop, Spark and Livy, and Jupyter Enterprise Gateway from 5.32.0 or 6.2.0), and an account runs at most 100 at once in a Region. It is RUNNING from its start and FINISHED once the cluster's step duration has passed, with AWS's "Execution is finished for cluster ..."; it stops at once as STOPPED, and FAILS when its cluster shuts down first or after 30 days. ListNotebookExecutions gives the newest first, within its From and To window (by default the last 30 days), 50 to a page. Executions are stored apart from their clusters, and IAM's resource-tag conditions read their tags. EMR's release comparison, its enum check, the time a cluster began to shut down, and reading an ARN's id and a resource's tags for IAM are now shared helpers, which CancelSteps, sessions, Studios and clusters use too. |
||
|
|
bd6c5810c3 |
feat(emr): keep EMR Studios and their session mappings (#8701)
EMR's Studio operations, CreateStudio, DescribeStudio, ListStudios, UpdateStudio and DeleteStudio, and its Studio session mappings, Create, Get, List, Update and DeleteStudioSessionMapping, were not served. Floci now keeps Studios, checked against its own EC2 and IAM Identity Center: a Studio's VPC, at most 5 subnets and its two security groups must exist, the subnets and groups in the VPC; an SSO Studio needs a UserRole and an IAM one may not have one, and the IdP members are for IAM Studios only; an SSO Studio needs the account's IAM Identity Center instance, or the one it names. UpdateStudio keeps every earlier subnet. A session mapping is for an SSO Studio, names its user or group by id or by name but not both, and that identity must be in the instance's identity store, and is found again by the id or name it was made with. Studios and mappings list in the order they were made, by a sequence no deletion frees. AddTags and RemoveTags take a Studio's id, and IAM's resource-tag conditions read a Studio's tags. Floci serves no Studio: its URL is on Floci's own address. Identity Store gains typed lookups of a user by name and a group by id or display name, and EMR's random id helper is shared. |
||
|
|
bb57e63b8e |
feat(emr): keep Spark Connect sessions on a cluster (#8699)
EMR's session operations, StartSession, GetSession, ListSessions, TerminateSession and GetSessionEndpoint, were not served, and RunJobFlow dropped SessionEnabled. Floci now keeps a cluster's sessions and their lifecycle, without starting a Spark Connect server for them. RunJobFlow keeps SessionEnabled and DescribeCluster reports it. StartSession needs a cluster with sessions enabled, on emr-spark-8.0.0 or later, with Spark, RUNNING or WAITING, with one primary node and fewer than 1000 sessions that have not ended, as the Management Guide's "Interactive sessions" gives them; a request needs a Name and an idle timeout within 24 hours. It answers SUBMITTED, and the session is IDLE from then on until its idle timeout (60 minutes by default), TerminateSession, or its cluster shutting down ends it. A retry with the same client request token that asks for the same session answers as the first call did. Sessions are kept apart from their clusters, so ended ones weigh on no cluster read or write. GetSessionEndpoint gives an endpoint on Floci's address and a token valid for an hour. ListSessions gives the newest first, by state, a page at a time. A request member of the wrong JSON type is refused with SerializationException. The cluster's installed applications are read by one helper, which the Hive and Pig checks now share with the Spark one. GetSessionEndpoint's endpoint and token come from core.common.SparkConnectEndpoint, which EMR Serverless's GetSessionEndpoint now uses too. |
||
|
|
6e30baf46c |
feat(emr): run a MapReduce JobHistory server on a cluster's primary node (#8662)
EMR's primary node runs one (a release's mapred-site classification "Restarts Hadoop MapReduce-HistoryServer"); Floci's did not, so a client asking about a MapReduce job whose application master had ended, for its counters or task reports, waited about 30 seconds a call on 0.0.0.0:10020 and got nothing. Pig asks after each of its MapReduce jobs, so #8636 turned its task reports off and gave its client one try. A cluster that runs YARN now starts `mapred historyserver` beside the ResourceManager, on Hadoop's own ports and where HDFS listens, from the jobs' history in the cluster's HDFS, and its primary node is ready once the server answers. A step's MapReduce settings name it, and so do a Hive step's, for a query run on MapReduce; an emr-spark-* node runs it from the Hadoop it keeps apart. The node scripts' readiness waits share one helper. Pig's workaround goes: its MapReduce jobs' counters come from the server, as on EMR. |
||
|
|
30f8a9985e |
feat(emr): run Pig steps on Apache Pig, an opt-in download added to the cluster's image (#8636)
No AWS image carries Pig, so a Pig step failed without running. With floci.services.emr.pig.enabled on (off by default), a docker cluster whose Applications name Pig gets Apache Pig 0.18.0 in its image: downloaded to a temporary file from the first of floci.services.emr.pig.urls that gives it whole with the checksum floci.services.emr.pig.sha256 names (a URL that fails, stalls for a minute or gives another checksum passes to the next), then streamed into /usr/lib/pig as EmrReleaseImages makes the image, with Tez from the release's Hive image and a /usr/bin/pig that EMR's own pig-script runs. Pig runs on the image's Tez, its bundled Tez and protobuf 3 left out, on the cluster's YARN or in local mode, with exectype=tez, a working directory without a scheme, which S3A takes, and no task reports and one try for counters from the MapReduce JobHistory server the cluster does not run, then the cluster's tez-site and pig-properties, in a pig.properties of the step's own; pig-log4j and pig-env reach Pig too. A command step's new tez-site.xml shares Hive's Tez-on-YARN settings. Without the setting, a Pig step on a cluster that installs Pig still fails without running, its message naming the setting; on one that does not, EMR's pig-script says "Pig isn't installed." as on EMR. |
||
|
|
f15c14979e |
fix(emr): give a cluster's instance groups and fleets its states (#8526)
A cluster's instance groups and fleets reported RUNNING, with all their capacity, from its creation until it was TERMINATED, whatever state the cluster itself was in. InstanceGroupState and InstanceFleetState have PROVISIONING, BOOTSTRAPPING and TERMINATING too, and the Management Guide's events end an instance fleet's provisioning with "Provisioning for instance fleet ... is complete ... The instance fleet now has On-Demand capacity of Num". No source says when each applies, so they now follow the cluster's state, Floci's reading: PROVISIONING while it is STARTING, with nothing running or provisioned yet, BOOTSTRAPPING with every instance up for its bootstrap actions, RUNNING while it runs or waits, and TERMINATING as it ends, the instances still running. One added later takes the state its cluster's others are in. ListInstances gives each instance its group's or fleet's state, lists those being provisioned, and filters by InstanceStates per instance. A cluster terminated while it is STARTING keeps listing the instances it was provisioning, still PROVISIONING and none of them running, until it is TERMINATED, so the same instances are listed throughout. |
||
|
|
73f2c348b6 |
fix(emr): check the step limits the API reference and the guide give (#8519)
EMR's documentation sets four limits on steps that Floci did not check: StepConcurrencyLevel "a minimum of 1 step and a maximum of 256 steps" (ModifyCluster; "The maximum value is 256" for RunJobFlow); "only 256 steps can be RUNNING or PENDING at any given time"; an ActionOnFailure other than CONTINUE added while the level is above 1, where "The step is not submitted and the action fails with a message that the ActionOnFailure setting is not valid"; and CancelSteps, "Available only in Amazon EMR versions 4.8.0 and later, excluding version 5.0.0", with "A maximum of 256 steps ... in each CancelSteps request". Each is now refused in the error code its operation's model points at: ValidationException from RunJobFlow and AddJobFlowSteps, which declare no InvalidRequestException, as Floci's other refusals of theirs, and InvalidRequestException from ModifyCluster and CancelSteps. No source gives AWS's messages, so they are Floci's. |
||
|
|
ec9c19ff62 |
feat(emr): run a cluster's bootstrap actions on its core and task nodes (#8502)
Bootstrap actions "run on cluster after Amazon EMR launches the instance", on every node, and "If you add nodes to a running cluster, bootstrap actions also run on those nodes in the same way". Floci ran them once, as on the primary node, and every node ran from the image they left, so an action's branch for the core or task nodes never ran. Where a cluster's core and task nodes run in containers of their own, each now runs the actions too, in a bootstrap container of its own beside the primary node's, as that node: its node files say CORE or TASK, the cluster's relay answers its instance metadata as that node, its output goes under its own instance id, and the container is kept as the image the node runs from, so it holds what its own actions installed. A node a resize adds runs them before it starts, and one that leaves takes its image with it, so one added again runs them again. AWS terminates a node whose action fails and says only that "If too many instances fail their bootstrap actions, then Amazon EMR terminates the cluster. If just a few instances fail, Amazon EMR attempts to reallocate the failed instances and continue". Floci runs a node's actions again once, in a fresh container, and a second failure ends the cluster with BOOTSTRAP_FAILURE and a message of Floci's after the primary node's, as no source gives AWS's words or an error code for a core or task node. |
||
|
|
f71476037a |
feat(emr): write the node files AWS documents on a cluster's nodes (#8473)
An EMR node keeps files about itself that bootstrap actions read to tell which node they run on. AWS documents two fields of them: the EMR Management Guide's bootstrap action reads isMaster from /mnt/var/lib/info/instance.json, and AWS's Knowledge Center reads instanceRole from /mnt/var/lib/instance-controller/extraInstanceData.json with jq, comparing it, lowercased, with master, core and task. Floci now writes those two fields, and nothing else: isMaster true and instanceRole MASTER in the bootstrap actions' container and each step's, which run as on the primary node, and in the primary node's own, and false with CORE or TASK in each core or task node's, the roles as the API's InstanceRoleType names them. They are written as the image's hadoop user, whose /mnt is, so Hive's metastore can still write under /mnt/var/lib, and moved into place whole, as steps share /mnt. The bootstrap container's copies go before it is kept as the cluster's image. Files that cannot be written fail the bootstrap, the step or the node. |
||
|
|
c1a8a3b3ac |
feat(emr): serve a cluster's nodes their instance metadata (#8449)
Every node of an EMR cluster is an EC2 instance, so any process on it, a bootstrap action, a step or a Spark executor, reads its instance metadata at 169.254.169.254. In the docker runner mode nothing answered there: a bootstrap script reading its availability zone got nothing. A relay container on the cluster's own Docker network now holds that address as a link-local one, as ECS's credentials endpoint is held, and each of the cluster's containers gets a link-local address of its own there, so none needs privileges. The relay forwards to Floci's EC2 metadata server, naming its caller in X-Forwarded-For, which the server reads only from the relays it trusts; the server answers each container as the instance it is: the bootstrap actions and each step as the primary node, each core or task node's container as that node, with the instance id, type, private address and name ListInstances gives, the cluster's availability zone and its JobFlowRole instance profile. The metadata server now starts for the docker runner mode too. DescribeCluster's Ec2InstanceAttributes now gives Ec2AvailabilityZone, the one RunJobFlow's Instances.Placement names, else the Region's first, so the metadata and the cluster agree. |
||
|
|
0ae7f8bf89 |
fix(emr): put a cluster's nodes on the network Floci's containers share (#8429)
A cluster's primary, core and task nodes ran on the cluster's own Docker network alone, so a cluster-mode Spark driver or an executor on them could not reach an MSK cluster's brokers, an RDS instance or any other container Floci starts: reading a topic timed out waiting for a node assignment. The nodes did not use Floci's DNS either, so Iceberg's S3FileIO, which addresses buckets as virtual hosts, failed on UnknownHostException for <bucket>.<host>. Each node now joins the network its cluster's steps run on, the one those containers are on, before it starts, with Floci's DNS, as a cluster's nodes reach what is in their VPC; executors reach Floci's S3 as the steps do. A node an earlier Floci left on the cluster's network alone starts again on its data. Where the steps share a namespace or have no network of Floci's, nothing changes. A node's HDFS and YARN listen on its address on the cluster's own network alone, found in that network's subnet as the node starts, so another cluster's step on the shared network reaches neither, nor submits work to the nodes. Hive 3's metastore has no setting for the address it listens on, so the primary node of a cluster with Hive or HCatalog, which runs it, stays on the cluster's network alone, and so does every node where Docker does not say that network's subnet. ContainerBuilder.withJoinedNetwork names a further network a container joins between its creation and its start, and ContainerLifecycleManager connects it there, removing the container when it cannot. |
||
|
|
8ba3f00443 |
fix(emr): give back a cluster's security configuration and refuse an unknown one (#8422)
RunJobFlow kept the SecurityConfiguration it was given, but DescribeCluster never wrote it out, so the cluster came back with none, although the model's Cluster has the member. It is given back now. RunJobFlow also took a security configuration that was never created. A cluster names one CreateSecurityConfiguration made, so one that does not exist is now refused with ValidationException "Security configuration does not exist: <name>". No source gives AWS's answer, so the code is the one RunJobFlow refuses its other input with in Floci, and the wording that of DescribeSecurityConfiguration and DeleteSecurityConfiguration; emr.md says so. |
||
|
|
6971626d82 |
fix(emr): give a step's command the sudo bootstrap actions have (#8415)
A step's script that ran sudo -u hadoop spark-submit ..., as a step does on EMR, failed with exit code 127, as the image steps run in has no sudo. The Release Guide's "Using HBase snapshots" runs a command-runner.jar step of sudo -u hbase, and the Management Guide's Kerberos users page a script-runner.jar script running sudo kadmin.local. Only bootstrap actions had Floci's sudo, which went before the image was kept. Each step on a cluster now finds that same sudo first on its PATH, written next to the hdfs and hadoop-streaming stand-ins the cluster's Hadoop setup already writes there, and a Hive step's shell commands find it too, written while its container is still root. It drops its options, a long one's value given apart included, and runs the command as the step's own hadoop user, so sudo -u hadoop runs as on EMR, while a command that needs root fails as it would for hadoop. The script moves to EmrServerlessSparkRunner, where the setup is, and the bootstrap actions write it from there. |
||
|
|
be6488b7ea |
fix(emr): remove the release images a newer pull replaces (#8395)
A cluster's release image is named after the ids of the two images it is made of, so a newer pull of either makes another, and the older one stayed on the Docker daemon for good. Each release image is now labelled with its kind: its release, the names of the two images and what is copied. Once Floci makes a newer image of a kind, it removes the others of that kind, without force, so one a container still uses stays until the next newer one. Another kind (with or without Hive, or other image names) is never touched, and an image made before the label is left as it is. Images of one kind are made one at a time, the two names resolved to ids under that kind's lock, so one made of the older images never comes after the newer one to remove it. A step or a bootstrap holds the image it was given until it ends, as it may have no container of it yet, and a held image is not removed either. A failure to remove one is logged with its exception; the new image is there, so it fails nothing. |
||
|
|
c99d8ee5ea |
fix(emr): list each instance fleet's InstanceTypeSpecifications (#8354)
ListInstanceFleets wrote no InstanceTypeSpecifications: the fleet kept only the names of the instance types it was created with. The Terraform AWS provider reads instance_type_configs back from that member, a ForceNew set in both aws_emr_cluster and aws_emr_instance_fleet, so a fleet cluster read back empty after apply and every later plan replaced it. A fleet keeps the InstanceTypeConfigs it was given, from RunJobFlow and AddInstanceFleet, and ListInstanceFleets returns each as the InstanceTypeSpecification it describes: its type, bid price, custom AMI, priority and configurations as given, a WeightedCapacity of 1 where it sets none and a BidPriceAsPercentageOfOnDemandPrice of 100 where it sets neither bid price, the defaults the API reference gives for both, and its EbsConfiguration as one EbsBlockDevice per volume. The reference names no devices, so they are /dev/sdb, /dev/sdc and on. A fleet stored before this has its instance types alone, with the same defaults. |
||
|
|
7981cadc7c |
fix(emr): keep a cancelled running step's place until its driver is gone (#8351)
CancelSteps on a RUNNING step stopped its driver and started the next
PENDING step at once, but stopping a driver only asks for it: with a
step concurrency level of 1 the next step's driver could start beside
the cancelled one's. The Management Guide's "Cancel steps": "Canceling
a running step does not allow a pending step to start running, assuming
no change to stepConcurrencyLevel", and CancelSteps "is idempotent but
asynchronous".
In the docker runner mode a cancelled RUNNING step is now CANCEL_PENDING
while its driver stops, with the guide's step event for that state ("was
cancelled at Time and is pending cancellation", WARN), and keeps its
place among the running steps. Once its driver is gone, however it
ended, the step is CANCELLED, takes no ActionOnFailure, and the next
PENDING step starts. A second cancel answers SUBMITTED. A driver Floci's
own teardown stops leaves the step CANCEL_PENDING, as it leaves a
RUNNING one, and a restart cancels it, in either runner mode;
TerminateJobFlows cancels it at once. Until it is gone it also counts as
running for a failed step's CANCEL_AND_WAIT. In the immediate mode
nothing runs, so a cancelled step is still CANCELLED at once.
|
||
|
|
16ff5a2c74 |
feat(emr): give a cluster a bootstrap failure ended its ErrorDetails (#8267)
A cluster whose bootstrap action failed in the docker runner mode ended with BOOTSTRAP_FAILURE and AWS's message, but DescribeCluster and ListClusters gave no Status.ErrorDetails, which the Management Guide's error code pages point to for the failed action, its return code and its script. - An action that exits with another code than 0 gives BOOTSTRAP_FAILURE_PRIMARY_WITH_NON_ZERO_CODE, with the ErrorData keys its page lists: primary-instance-id, bootstrap-action, return-code, amazon-s3-path and public-doc. A script that cannot be read gives BOOTSTRAP_FAILURE_BA_DOWNLOAD_FAILED_PRIMARY, with the same keys but return-code. ErrorData is a list of maps and no source shows how AWS spreads the keys over them: Floci gives one map holding them all. ErrorMessage is the reason's message and the error code's page, in Floci's words. - A bootstrap that cannot run at all, or that Floci stopped, ends with INTERNAL_ERROR as before and has no ErrorDetails: no documented code fits. - The details are stored with the cluster, so they survive a restart with persistent storage, and emr.md says what Floci gives. |
||
|
|
f5fd41a6ac |
fix(emr): list an instance fleet's instances (#8183)
ListInstances listed only instance groups' instances, so a cluster made of instance fleets listed none, though its core and task nodes run as containers named by the private DNS names its instances would have. - A fleet has an instance for each unit of its capacity, as its nodes do, its on-demand ones first, each of the first instance type in its InstanceTypeConfigs, which Floci now keeps, and with its InstanceFleetId. - The primary fleet's instance is numbered first, i-00000000000000001 at 10.0.0.1, as MasterPublicDnsName names it, and every other fleet's are at 10.<fleet>.0.<n>, the names its nodes run under, kept while another fleet resizes. One helper numbers groups and fleets for both. - An ended fleet's instances stay listed as TERMINATED for 30 days, as an ended group's do, from its target capacities, which it can no longer change. - InstanceGroupId, InstanceGroupTypes, InstanceFleetId and InstanceFleetType now narrow the listing, all given ones together; they were ignored. A call lists at most 2,000 instances, building only that page, with a Marker for the rest, so a fleet of any capacity costs one page, counted in longs, as a fleet's two capacities add up past an int. A cluster has instance groups or instance fleets, never both, as they "cannot coexist in a cluster": RunJobFlow with both, AddInstanceGroups on a cluster with fleets and AddInstanceFleet on one with groups are refused, and so is a fleet without its required InstanceFleetType or an InstanceTypeConfigs member without its required InstanceType. |
||
|
|
54ea160aa6 |
feat(emr): run a step's MapReduce and Hive's Tez on the cluster's YARN (#8151)
Where a docker cluster runs YARN its Spark ran on it, while MapReduce and
Hive's Tez stayed in local mode, in the step's container, and a job's own
-D mapreduce.framework.name=yarn failed.
- A step's mapred-site names YARN and the layout of the cluster's nodes,
which yarn.application.classpath's default does not, S3A's AWS SDK, and
the step's AWS environment for the application master and tasks, sized
for a NodeManager; the cluster's mapred-site replaces them.
- A step's hadoop, hadoop-streaming and hdfs dfs run from the nodes'
Hadoop, /usr/lib or an emr-spark-* release's /opt, set for that command
alone, so a spark-submit in the same step keeps the release's own.
- The images hold EMR Serverless's build of Tez, whose tez-site.xml names
its own plugins. On YARN a Hive step names the stock classes from the
same jars, real ports and bind addresses, ${env.NM_HOST} left for the
application master's node to fill in, Tez's jars from the node's own
disk, and one virtual core a task, as YARN's default scheduler grants
one and Tez gives back a container that does not match what it asked.
Intermediate compression is off, as the image's codec needs a native
library it lacks.
Where a cluster runs no YARN, MapReduce and Tez stay in local mode.
Two Docker cases check that a streaming job's tasks and a Hive query's
Tez tasks run in YARN's containers on the cluster's nodes. With them the
two EMR Docker classes take 651s and 402s on CI's runners, so the shard
partitioner weighs them at that, as at 280s and 260s their shard ran into
Surefire's 25 minutes.
With that split, PipesStreamEnrichmentDockerIntegrationTest ran in a JVM
where no class before it had told RestAssured how to send and read
DynamoDB's application/x-amz-json-1.0, which it relied on; it now does so
itself, as other tests do.
|
||
|
|
7ebed877a8 |
feat(emr): run a cluster's core and task nodes in containers of their own (#8066)
A docker cluster's YARN and HDFS ran on its primary node alone, however many instances the cluster named. On EMR "Core nodes run the Data Node daemon", "a core node runs YARN NodeManager daemons, Hadoop MapReduce tasks, and Spark executors", and "Task nodes don't run the Data Node daemon". - Each core and task node is a container of its own on the cluster's network, with its data in a volume of its own, its name there the private DNS name ListInstances gives it. The primary node keeps a DataNode and a NodeManager only on a cluster created with no core node, which keeps them as core nodes are added, and a primary node whose volume holds a DataNode's data runs it in any case, so the blocks on it stay in reach. - ListInstances gives each group's instances addresses of their own, so an instance keeps its address while another group resizes. - How many follows the instance groups' counts or the instance fleets' target capacities, at most yarn-max-worker-nodes, core nodes first. A fleet's unit of capacity is one node. With 0 a cluster runs on its primary node alone. - HDFS keeps what EMR's does: one copy of a block below four core nodes, two below ten, three otherwise, or the hdfs-site classification's dfs.replication. Steps' Spark, Hive and hadoop clients write that many. - A resize reaches the nodes of a cluster a step has started them on, on another thread: a new node takes work once it has registered, and one no longer wanted is decommissioned, HDFS and YARN telling when it may go, within EMR's default hour, each node its own, then goes with its data. Core nodes stop at the copies HDFS keeps. - A core node's NodeManager is decommissioned only once HDFS has moved its blocks, as a decommissioned NodeManager exits, which ends the node's container, its DataNode with it. A core node that has gone stays among HDFS's excluded nodes until the NameNode has it dead, 40s after it stopped, so the copies it held never count again. - A core node that stops before HDFS has moved its blocks starts again on its data, and one a shutdown cut off while it was decommissioned starts again with the cluster's next step, from its volume, which carries its name, to be decommissioned then. A task node's volume a shutdown left goes. - A decommissioning round that fails, a refresh of HDFS's or YARN's lists among them, is tried again on the next; a node Docker will not remove yet stays to be removed then, and one whose start a teardown passed goes. A cluster's end removes the volumes of nodes that have no container, and finishes even when Docker cannot list its nodes. - The node list is read inside the cluster's lock, so a step queued before a resize starts the nodes asked for by then. - Container logs come from every node, a decommissioned one's first. |
||
|
|
c9d9ba24f4 |
fix(emr): refuse reading the managed scaling policy of an ended cluster (#8065)
GetManagedScalingPolicy returned the policy of a cluster that was shutting down or had ended. AWS answers ValidationException "A job flow that is shutting down, terminated, or finished may not be modified." there, as Terraform's acceptance runs recorded, and Terraform's provider reads that answer as the policy being gone. Floci kept returning it, so a refresh after termination kept a policy AWS reports gone. A TERMINATING, TERMINATED or TERMINATED_WITH_ERRORS cluster now gets that answer. emr.md no longer says no answer is recorded for the managed scaling calls: Terraform's provider also expects it from RemoveManagedScalingPolicy. |
||
|
|
4c9572b95b |
fix(emr): refuse changes to a cluster that is shutting down or ended (#8037)
ModifyCluster, the four Set* setters, and Put and Remove of a cluster's managed scaling, auto-termination and automatic scaling policies all changed a TERMINATED cluster, and AddTags and RemoveTags its tags. AWS documents these for running clusters, but no answer for an ended one is recorded. So they give the one AWS gives AddJobFlowSteps and ModifyInstanceFleet, "A job flow that is shutting down, terminated, or finished may not be modified.", in the code each operation's model points at, as AddInstanceGroups and AddInstanceFleet already did for a TERMINATING cluster: InvalidRequestException with ErrorCode INVALID_JOB_SHUT_DOWN for ModifyCluster, ValidationException for the others, whose models declare no InvalidRequestException. A Set* request naming such a cluster changes none of the clusters it names. AddInstanceGroups and AddInstanceFleet now answer a TERMINATED cluster that way too, in place of "Cluster <id> is terminated.", which no source has. The Management Guide says "you cannot add, edit, or remove tags from a terminated cluster" and names no error. AddTags and RemoveTags refuse an ended cluster with InvalidRequestException "Tags cannot be modified on terminated clusters.", the message a tagging tool matches from AWS. |
||
|
|
874493c446 |
feat(emr): run a cluster's Spark steps on YARN on its primary node (#7864)
A docker cluster's Spark steps ran in local mode, in one container, so a script's own spark-submit --master yarn failed and a step's --deploy-mode was dropped. On EMR "the primary node runs the YARN ResourceManager service" and a core node "YARN NodeManager daemons, Hadoop MapReduce tasks, and Spark executors". - On a Docker network of the cluster's own, the primary node's container also runs a ResourceManager and a NodeManager, whose capacity is yarn-node-memory-mb and yarn-node-vcores. - The node needs Spark, Python and what the bootstrap actions installed, so it runs from the image the steps run in: the bootstrap's, else the release's EMR Serverless image with its Hive image's HDFS, MapReduce and YARN, and Hive on a cluster with Hive. A cluster without Hive gets no hive, so its Hive step still says "Hive isn't installed.". - Spark steps submit with --master yarn, keeping the step's own --master and --deploy-mode; a command's own spark-submit reads the same from its spark-defaults. Executors and a cluster-mode driver are sized for the NodeManager, which the cluster's spark-defaults replace, get the step's AWS environment, and reach Floci at its address on the cluster's network; a client-mode driver is reached at its container's name there. - A YARN application's container logs go to <LogUri>/<cluster-id>/containers/<application>/<container>/ when a step ends, as a cluster-mode driver's output is there and not in the step's, without launch_container.sh, which holds the step's session. A node that does not become ready leaves the last of its output in Floci's log, as the container goes with its cluster. YARN's Java 17 options go through JDK_JAVA_OPTIONS, which the Java 8 of an emr-6.x image ignores. An emr-spark-* release has no Hive image, and emr-7.5.0's HDFS and YARN do not run on its newer Hadoop, so its image holds the whole of emr-7.5.0's Hadoop in /opt, which only the node's daemons run from, and Spark keeps the release's own. Those daemons are Hadoop 3.4.0's, where the Release Guide lists 3.4.2 for these releases. Clusters in a namespace the steps share or with no network stay in local mode, as do MapReduce and Tez, and core and task instances get no NodeManager yet. |
||
|
|
6974d8c096 |
feat(emr): give a cluster with HCatalog Hive's client and metastore (#7719)
A docker cluster ran Hive steps, made its steps' image with Hive and ran
Hive's metastore service on its primary node only when its Applications
named Hive. EMR installs Hive's client and its HCatalog server with
HCatalog too, and the Release Guide's HCatalog page says "HCatalog is a
tool that allows you to access Hive metastore tables within Pig, Spark
SQL, and/or custom MapReduce applications".
- EMR's hive-script, in the emr-scripts package every node has, checks
only "which hive" ("Hive isn't installed." otherwise), and the hive
it finds is hive-client's, which HCatalog installs, so a Hive step
runs on a cluster with HCatalog alone.
- Its HCatalog server, hcatalog-server, is the metastore service:
Hive's hcat_server.sh runs "hive --service metastore".
So a cluster whose Applications name HCatalog installs Hive as one
naming Hive does: its Hive steps run, in the release's image with Hive,
on the metastore service its primary node runs, which its Spark steps'
Hive client uses too.
An emr-spark-* release, the AWS runtime for Apache Spark, includes
neither ("This release includes the following applications:
AmazonCloudWatchAgent, Delta, Hudi, Iceberg, JupyterEnterpriseGateway,
Livy, and Spark."), and has no Hive image to make its steps' image with
Hive from, so a cluster of one installs neither, whatever its
Applications name; one naming Hive asked for that image since #7459.
emr.md now backs a cluster's Spark steps using its metastore with the
Release Guide's EMR pages, in place of the Glue page #7636 quoted:
Spark's default catalog "always connects to a Hive metastore", and
Using HCatalog has Spark SQL read a table the HCat CLI made.
|
||
|
|
ba9a9c8155 |
feat(emr): run Hive's metastore service on a docker cluster with Hive (#7636)
A cluster's Hive steps kept their metastore in an embedded Derby
database in the cluster's /mnt, so only one Hive step at a time could
use it ("Another instance of Derby may have already booted the
database"), and Spark steps, with a catalog of their own, saw a Hive
step's tables only through the Glue Data Catalog. "By default, Hive
records metastore information in a MySQL database on the primary node's
file system", and the Glue Data Catalog is the one to pick "when you
require a persistent Hive metastore or a Hive metastore shared by
different clusters".
- On a cluster whose Applications name Hive, the primary node's
container runs Hive's metastore service on port 9083, once its HDFS
is up: with the image's Hadoop configuration, as Hive steps run, the
cluster's HDFS, its Derby database in the node's own volume, which
only the service opens, and its warehouse in the HDFS. The node is
ready once it listens, and ends if it exits, as for the HDFS daemons.
- It is on the cluster's own Docker network with the HDFS, so only the
cluster's steps reach it. It reaches tables' S3 locations through S3A
on Floci's S3, with a session for the cluster's EC2 instance
profile's role, which goes with the container: at the host's address
when Floci runs on the host, and as floci when Floci runs in a
container, which joins the cluster's network for it, as it joins EC2
VPC networks, and leaves it when the HDFS container goes. A start
that fails, or a container an earlier Floci left, does not keep
Floci there, and one Docker keeps Floci on stays known for the next
teardown.
- It gets the cluster's core-site and hive-site after its own
settings, as EMR's primary node does, so a hive-site warehouse folder
holds for it as for the steps. One an earlier Floci left running
starts again, as its session went with that Floci, and so does one
given Floci's address before Floci could join its network.
- A Floci that crashed is still on that network when it starts again,
and Docker lists it first, so what Floci launched then joined it and
reached the cluster's HDFS and metastore. Floci's own network is no
longer one it made, an EMR cluster's or a VPC's, its earlier owner
label included, or one Docker cannot inspect, unless it is on no
other, and its DNS server takes its address from that network.
- In a namespace the steps share, host or container:<id>, it does not
run: Hive 3.1 has no setting for the address it listens on, so it
would serve every interface of the namespace. Hive steps keep the
embedded Derby database there, as they do with no network.
- Hive steps get its URI in place of the embedded Derby settings, and
Spark steps' Hive client gets it too, so a Spark step reads a Hive
step's tables and makes tables a Hive step reads; a hive-site or
spark-hive-site naming the Glue Data Catalog's client factory still
uses Floci's Glue.
- Two Hive sessions starting at once both upload Hive's exec jar to
the same HDFS folder when it is not there, and one could launch Tez
tasks with a jar that changed under it, so the primary node puts it
there first, under the name Hive gives it.
EmrHiveStepsDockerIntegrationTest runs two Hive steps at once on a
cluster's metastore, and a Spark step that reads a Hive step's table
and makes one the next Hive step reads.
|
||
|
|
3a64d2b761 |
feat(emr): give each docker cluster a real HDFS on its primary node (#7496)
Every EMR cluster runs HDFS: its primary node "also runs the HDFS
NameNode service". In the docker runner mode a cluster's HDFS was a
folder of its /mnt volume behind a view of the hdfs scheme, so an
hdfs:// path naming a host was not served, hadoop fs -ls / failed, and
Hive, which looks up the encryption zone of any hdfs:// path, reached it
under viewfs, where a table at an hdfs:// location failed. Each cluster
now runs a NameNode and a DataNode.
- EmrClusterStorage starts them in a container of their own, from the
release's EMR Serverless Hive image, which has HDFS's daemons where
the release's image has only the client. It runs as root only to add
the primary node's name to its hosts file and give its data volume to
the hadoop user, then runs both daemons as that user, with one copy of
each block and permissions off, and makes /tmp and /user/hadoop once
the DataNode has joined. The data is in a volume of its own, so the
first container to mount the cluster's /mnt volume is still a step's,
which fills it with what the bootstrap actions left there. It is on a
Docker network of the cluster's own, which only the cluster's steps
join besides theirs, as its HDFS serves its files to any client that
reaches it, so another cluster's steps, another account's too, do not.
- The AWS runtime for Apache Spark's releases, emr-spark-8.0.0 on,
publish no Hive image, so their clusters run HDFS from emr-7.5.0's.
Hadoop keeps its client-server protocols compatible across a major
version's minor releases, so their newer client reaches its NameNode.
- A step's thread starts it after the cluster's volumes, from the id
its image's pull, when it is missing, resolves, and waits up to two
minutes from then, the
NameNode on its port its own, the DataNode joined and the NameNode out
of safe mode, as the NameNode's JMX says; a step that comes while
it starts waits, and one that finds it running uses it. A failure
fails the step ("The step could not start: ..."), and one whose
container Docker cannot tell the state of leaves it as it is.
- The daemons log their warnings and errors to the container's output.
- When either daemon exits, the container ends and its readiness goes,
so the next step starts it again on the data its volume keeps; one
that finds it about to stop starts it again once.
- Steps reach it by the primary instance's PrivateDnsName, as
ListInstances gives it, on port 8020: their containers resolve that
name to the HDFS container's address, and fs.defaultFS names it, so
hdfs:// paths without a host and paths without a scheme lead there.
ListInstances numbers the MASTER group's instance first, so the name
holds while other groups resize.
In a namespace the steps share, the host's or another container's,
which the HDFS container joins too, they reach it on its loopback, and
its daemons listen there only, so no other interface serves its files,
which any client could change; one cluster's HDFS runs there at a
time, another's refused while it does. One a process with another
docker-network left running, in another namespace than the steps', is
started again in theirs on its data. With none, steps have no network,
so the cluster runs no HDFS.
- Hadoop's local job runner copies a job's -files to
/tmp/hadoop/mapred/staging on the local file system, then looks for
them at that path of the default file system, as JobResourceUploader
drops the folder's scheme. So in the hadoop command's configuration,
which a custom JAR's MapReduce in the driver reads too, the hdfs
scheme is a view of the cluster's HDFS in which that one folder is
the container's own. Spark and Hive keep HDFS's own client, as Hive
casts an hdfs:// file system to it to look up its encryption zone,
so a Spark step writes a Hive table in HDFS too.
- A reset or a shutdown removes the HDFS containers this process
started, found running or kept from an earlier process, after the
drivers that use them are stopped, and a step or a bootstrap handed to
its thread before it, however it then ends, starts no HDFS, driver or
successor after it but is left as one whose driver was stopped, and
none is handed to a thread until the reset is over; a container Docker
refuses to remove stays known for the next; a cluster's next step
starts its HDFS again on the data its volume keeps. The container and
its network go with the cluster's storage, and the startup sweep
removes those of clusters that are gone or have ended.
Every cluster now needs a Hive image, so the documentation of
image-template and hive-image-template says a mirror sets both.
The Docker-gated tests now cover a Hive table at an hdfs:// location, a
bootstrap action's file in /mnt, a structured streaming query keeping
its checkpoints in HDFS, a Spark step writing a Hive table there, hadoop
fs -ls /, and a DataNode that exits, after which the next step reads an
earlier step's file. The CI prefetch queues the Hive image for
EmrDockerRunnerDockerIntegrationTest's shard too.
|
||
|
|
5a4632229e |
feat(emr): run Hive steps in the docker runner mode (#7459)
In the docker runner mode a Hive step failed without running ("hive-script
and pig-script are not in the image steps run in"). On a cluster whose
Applications name Hive, a command-runner.jar step running hive-script, as
the AWS CLI writes a Type=Hive step ("hive-script --run-hive-script
--args" and the step's Args), or hive itself, now runs: the image's
hive-script runs hive with the arguments after --args, with Tez in local
mode, on the cluster's storage and Floci's S3.
- An EMR cluster's nodes hold every application it installs, so a
cluster with Hive bootstraps and runs every step in one image: the
release's EMR Serverless image with the Hive, Tez, HDFS, MapReduce and
YARN of its EMR Serverless Hive image (or the new hive-image-template).
EmrReleaseImages makes it the first time a release's cluster needs it:
a container of the EMR Serverless image, created and never started,
gets the Hive image's folders streamed in from a container of that
image, and is committed, as a bootstrap's container is, with no image
builder involved. The two images ship different builds of
emr-serverless-goodies-common under one name, so Tez keeps the Hive
image's in a folder of its own, its links rewritten to lead there, and
the Hive image's Hadoop configuration, which puts Tez on the class
path, goes to /etc/hadoop/conf.hive, which Hive runs with.
- The image is named after the release, the ids of the two images as a
container would run them (an image-registry-base included) and what
is copied, so a newer pull of either makes another; it is kept for the
release's next cluster, and made once at a time. The bootstrap and the
steps get its id, as they get a bootstrap image's, from their own
thread, which makes it first, unless the cluster has ended by then; a
failure to make it fails the step, or ends a bootstrapping cluster with
INTERNAL_ERROR.
- hive gets Floci's settings, then the cluster's core-site, tez-site and
hive-site properties as --hiveconf settings, then the step's own
arguments, so a step's --hiveconf wins as it does over hive-site.xml;
the cluster's hive-env exports are its environment.
- Its metastore is the cluster's own, as "Hive records metastore
information in a MySQL database on the primary node's file system": an
embedded Derby database in the cluster's /mnt, so a table one Hive step
makes is there for the next until the cluster ends. A hive-site naming
the Glue Data Catalog's client factory uses Floci's Glue instead.
- Hive reaches the cluster's HDFS through the same view of /mnt/hdfs
under the viewfs scheme: Hive looks up the HDFS encryption zone of any
hdfs:// path, which only an HDFS NameNode answers. A table without a
LOCATION is in /user/hive/warehouse there, which other steps read as
hdfs://.
- On a cluster without Hive, hive-script runs in the release's image, as
EMR's does without Hive ("Hive isn't installed."); NOT_RUN is
pig-script's alone.
The Docker-gated EmrHiveStepsDockerIntegrationTest runs the AWS CLI's
Hive steps on a cluster's metastore and HDFS, a hive-site for the Glue
Data Catalog, a cluster without Hive, and a bootstrapped cluster whose
installs a Hive step and a later step both find, in the emr-7.5.0
images, which the CI prefetch pulls for its shard.
EmrServerlessSparkRunner's hiveSettings now builds both services'
--hiveconf settings.
|
||
|
|
cfd7e83776 |
fix(glue): let the Glue catalog client read back tables and partitions (#7329)
The Glue Data Catalog client, which Spark's Glue catalog and Hive's Glue metastore use on EMR, could not read back a table it had just created on Floci: "NullPointerException: Cannot invoke java.lang.Integer.intValue() because the return value of Table.retention() is null". Floci's Table had no Retention, and its StorageDescriptor no StoredAsSubDirectories, SortColumns, BucketColumns, SkewedInfo or AdditionalLocations, so what the client wrote was dropped, and the client unboxes Retention, Compressed, NumberOfBuckets, StoredAsSubDirectories and an Order's SortOrder without a null check. Past that, a partitioned table came back with each partition, and so each row, five times: the client reads a table's partitions in five GetPartitions segments by default, and Floci answered every segment with all of them. Now: - Table keeps Retention and IsRegisteredWithLakeFormation, and StorageDescriptor keeps AdditionalLocations, BucketColumns, SortColumns, SkewedInfo and StoredAsSubDirectories, and the table and descriptor copies carry them. - every table and partition a catalog action returns (GetTable, GetTables, SearchTables, GetTableVersion, GetTableVersions, GetPartition, GetPartitions, BatchGetPartition) reads Retention as 0, IsRegisteredWithLakeFormation as false, and a storage descriptor's Compressed, NumberOfBuckets, SortColumns and StoredAsSubDirectories as false, 0, an empty list and false when they were written without them, as the CLI reference's get-tables output shows Glue doing. The stored records keep their nulls: Spectrum reads a partition's missing Compressed as its table's. - GetPartitions honours Segment, "a non-overlapping region of a table's partitions": a partition is in the one segment its values hash to, a SegmentNumber past the last holds none, and TotalSegments outside 1 to 10, a negative SegmentNumber or a missing member is a ValidationException, and a member that is not an integer a SerializationException. - a SortColumns entry that is null, lacks Column or SortOrder, or has a SortOrder other than 0 or 1 fails the whole CreateTable, UpdateTable, CreatePartition, UpdatePartition, BatchCreatePartition or BatchUpdatePartition with a ValidationException before anything is stored, as the client unboxes SortOrder on read. - the EMR runner gives the client the job's account as its hive.metastore.glue.catalogid, on a cluster and in an EMR Serverless run. Given none, the client in emr-7.10.0 asks STS GetCallerIdentity for it through an STS client no setting points at Floci, so a step reached real AWS STS and failed. The job's own account is what an unset one means, and a cluster's spark-hive-site or a run's spark-defaults one, for a Data Catalog in another account, still wins. IsRegisteredWithLakeFormation is always false, as Floci does not tie a table to a location registered with Lake Formation. |
||
|
|
db3efe8186 |
feat(emr): run a custom JAR's MapReduce and apply Hadoop classifications (#7294)
In the docker runner mode a custom JAR step whose main class starts a MapReduce job, such as the Management Guide's wordcount of Hadoop's examples JAR, never ended: its spark-submit read the image's mapred-site.xml, which names YARN, and the job kept retrying a ResourceManager at 0.0.0.0:8032. A Jar of /usr/lib/hadoop-mapreduce/hadoop-streaming.jar, where EMR has it, named a file the image lacks. And a cluster's mapred-site, hadoop-log4j and hadoop-env classifications reached none of its steps. Now, on a cluster: - a custom JAR or Spark step's spark-submit runs after the Hadoop setup a command gets, so its HADOOP_CONF_DIR is the copy with Floci's S3, the cluster's HDFS and MapReduce in local mode, which spark-submit puts on its class path; a MapReduce job its main class starts runs in the driver's JVM. - a Jar of /usr/lib/hadoop-mapreduce/hadoop-streaming.jar runs the image's /usr/lib/hadoop/hadoop-streaming.jar. - mapred-site, which will "Change values in the MapReduce application's mapred-site.xml file", goes in the copied mapred-site.xml ahead of Floci's local mode and staging folder, which win. - hadoop-log4j, which will "Change values in Hadoop's log4j.properties file", follows the copied log4j.properties, a later key winning. - hadoop-env's export classification starts the copied hadoop-env.sh, which the hadoop command reads, each value as given, single-quoted, as spark-env's exports are set without shell expansion; a name a shell cannot export is left out. The image's own lines come after and add to HADOOP_CLASSPATH rather than set it, so the Release Guide's HADOOP_CLASSPATH of /path/to/my.jar keeps the LZO codec the image's core-site.xml names, without which every job fails. - a jar the MapReduce home links that the image lacks is named on the step's standard error, as a job that needs it fails later, on its class path, and emr.md says which releases this has run on (emr-7.5.0 and emr-7.10.0). An EMR Serverless run still starts spark-submit as it is. A custom JAR step's spark-submit reads neither hadoop-env.sh nor Hadoop's log4j.properties, so those two do not reach it. |
||
|
|
048070e699 |
feat(emr): run hadoop-streaming and hadoop-lzo steps (#7264)
In the docker runner mode a command-runner.jar step running hadoop-streaming, which "Submits an Hadoop streaming program. In the console and some SDKs, this is a streaming step", or hadoop-lzo, the LZO indexer, failed without running, as the image's hadoop had no MapReduce; and a command's hadoop fs could not reach S3, its classpath having no AWS SDK v2 and the image's EMRFS not being pointed at Floci. Now a step's hadoop command, on its cluster: - runs MapReduce in local mode: links to Spark's shaded Hadoop client, the image's only copy of MapReduce, and to the jar Spark's own S3A finds the AWS SDK in make up its MapReduce home, so they are on its class path whatever HADOOP_CLASSPATH a command sets, and a copy of its mapred-site.xml sets mapreduce.framework.name to local. The local job runner names a job's -files and -archives by their path alone, which the default file system, the cluster's HDFS, resolves, so its staging folder is a link to the same path in the HDFS folder. - reaches Floci's S3 through S3A, with the settings its spark-submit gets, now one list for both, ahead of the cluster's HDFS and core-site. - logs to standard error when its log4j.properties is empty, as the image's is, in the layout of the Management Guide's step log lines, so a failed job's reason is in the step's stderr. - runs hadoop-streaming from the jar the image has, where the image's own hadoop-streaming names /usr/lib/hadoop-mapreduce, which it lacks. hive-script and pig-script steps still fail without running. |
||
|
|
b4ae0ce9e0 |
feat(emr): apply a step's Properties, core-site and spark-log4j2 (#7226)
In the docker runner mode a step's HadoopJarStep.Properties, "A list of Java properties that are set when the step runs. You can use these properties to pass key-value pairs to your main function", were kept but never applied, and of a cluster's classifications only spark-defaults, spark-hive-site and spark-env reached its steps. Now: - A custom JAR step's Properties are system properties of the JVM its main class runs in, through SPARK_SUBMIT_OPTS, each -Dkey=value in single quotes as spark-submit's launcher reads them, after any Java options a spark-env export puts there, so a step's own win. A command-runner.jar or script-runner.jar step's would be its runner's own JVM's, which Floci has none of, and a JVM's system properties do not pass to a process it starts, so they go nowhere. The API sentence is the only source; emr.md calls this Floci's reading. - core-site, which will "Change values in Hadoop's core-site.xml file", reaches Spark as spark.hadoop. settings ahead of spark-hive-site's, as core-site.xml comes ahead of hive-site.xml, with spark-defaults winning over both; a command's hadoop command gets it too, after the cluster's HDFS settings in its core-site.xml copy, escaped for XML. - spark-log4j2, which will "Change values in Spark's log4j2.properties file", follows the log4j2.properties of the Spark configuration a spark-env export of SPARK_CONF_DIR names, else the image's, in a copy of the step's own, a later key winning: a Spark step with some runs spark-submit after a wrapper that makes the copy, and a command's wrapper does the same before its own changes, now from that exported folder too, links followed. What is added starts on a line of its own, as the image's log4j2.properties has no line break at its end, and a value's leading spaces are escaped, as Properties.load would skip them. SparkJobRunner.Job gets coreSite and sparkLog4j2 components, which an EMR Serverless run leaves empty. |
||
|
|
a74a9b0ffc |
feat(emr): run s3-dist-cp steps (#7192)
In the docker runner mode an s3-dist-cp step, the Release Guide's way of
moving data "from Amazon S3 into HDFS where it can be processed by
subsequent steps", between buckets or back to S3, was FAILED without
running, and on the default TERMINATE_CLUSTER it ended its cluster with
errors. The EMR Serverless image steps run in has neither s3-dist-cp nor
the MapReduce it runs on.
Now a command-runner.jar step whose first argument is s3-dist-cp runs
Floci's own S3DistCp: a Python program, emr/s3-dist-cp.py, which the step's
command writes into the container and runs through spark-submit, copying
through Hadoop's file systems in Spark's JVM. The command wrapper gives it
what a Spark step gets: S3 paths in Floci's S3 and hdfs:// paths, and
those without a scheme, in the cluster's HDFS. It takes the options of
the Release Guide's table, --name=value or --name value, and -D
property=value:
- --src and --dest, a source folder's files keeping their folders;
- --srcPattern and --groupBy matched against the whole path; --groupBy
concatenates the files whose groups give the same name into one file
named by them, and refuses an expression with no group, as the guide
says S3DistCp does; --targetSize breaks a larger group into parts
numbered before the extension ("myfile0.gz, myfile1.gz"); without
--outputCodec a group keeps the compression its files share, named
with that codec's extension, or has none when they differ, each file
decompressed so the group is one stream;
- --outputCodec (gzip, gz, lzo, lzop, snappy, none) through Hadoop's
codecs, each source decompressed by its own extension;
- --deleteOnSuccess, deleting the files but not their folders, as AWS's
"Seven tips for using S3DistCp" says;
- --outputManifest, --previousManifest, --requirePreviousManifest and
--copyFromManifest, the manifest gzipped JSON lines of path, baseName,
srcDir and size, as that post shows them;
- --s3ServerSideEncryption, --storageClass, --disableMultipartUpload and
--multipartUploadChunkSize as S3A's settings; --numberFiles,
--startingIndex, --srcPrefixesFile and --appendToLastFile, the last
through a copy renamed over the file, as neither S3 nor the cluster's
HDFS appends in place. The copy has a name of its own and goes if the
writing fails, and the file steps aside, under a name of its own too,
until the copy has taken its place, coming back if it cannot, so a
failed append leaves it as it was. --s3Endpoint is ignored, S3 being
Floci's.
--requirePreviousManifest takes true or false, after = or as the next
argument, and alone is true, its default. A --srcPrefixesFile line ending
in / names that folder alone, its slash kept though Hadoop's Path drops
it; any other is a prefix as S3 lists one, logs/day taking in
logs/day-old/.
A bucket name with an underscore fails the step, as S3DistCp "does not
support" one, and so does a copy Hadoop fails, leaving what was copied.
A copy that would write two files to the same path, the manifest
included (a.log and a.log.gz with --outputCodec=gzip), a file over one
of its own sources, as with the same --src and --dest, or a file outside
--dest, through a .. in a manifest's baseName or in --outputManifest
(Hadoop's paths resolve it), or a file with no name, from a --groupBy
whose groups matched nothing say, fails before it writes anything. emr.md
says what is Floci's own reading: the grouped file's folder,
--numberFiles' naming, a group's compression without --outputCodec and
that refusal.
|